[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix volume measurement NaN

Kasper (Oct 2, 2025, 11:46 PM +0200) 70cba330 ebca8302

+6 -3
+6 -3
src/lib/visualizer/visualizer.ts
··· 63 63 const [ref, min] = sample_volume((def[0] * 1000) / (1000 / frame_rate)) 64 64 const [sample] = sample_volume((def[1] * 1000) / (1000 / frame_rate)) 65 65 const scaled = scaleLinear([min, ref], [0, 1])(sample) 66 - const raw = Number(Math.pow(scaled, 1.5).toFixed(3)) 66 + // Make sure we don't do pow with a negative number 67 + const scaled_safe = Math.max(0, scaled) 68 + const raw = Number(Math.pow(scaled_safe, 1.5).toFixed(3)) 67 69 if (isNaN(raw)) { 68 - console.log('raw is NaN') 70 + console.error('raw is NaN') 71 + return 1 69 72 } 70 - return isNaN(raw) ? 1 : raw / 2 73 + return raw 71 74 } 72 75 73 76 function get_raw_volume() {