You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(audio): initialize SoundLevelMeter smoothing on the first block #4518
In SoundLevelMeter::processBlock, the global dBFS floor starts at +infinity. With a positive smoothing alpha, the first nonempty block blends its finite dBFS with infinity, leaving the floor infinite and getSPL() at negative infinity. With alpha 1, 0 * infinity can produce NaN.
Repro: construct SoundLevelMeter(33.0, 0.5), process one sample of value 1000, then call getSPL(); expected a finite value, actual -infinity.
Proposal
Initialize the smoothed floor from the first valid measurement before blending later blocks.
Acceptance criteria
Add a focused test that is RED on current master for a first nonempty block with smoothing enabled, then GREEN after the fix.
getDBFS() and getSPL() are finite after the first and subsequent valid blocks for representative positive alpha values, including 1.
Decisions
Scope is first-measurement initialization, not a change to the meter's smoothing model; the failure is deterministic without hardware.
Priority: medium; the default smoothing path can invalidate SPL output.
Activity