pub fn noise_floor_min_stat(energies: &[f32], window: usize) -> f32Expand description
Estimate the noise floor as the bias-compensated minimum energy over the
trailing window entries of energies (per-frame RMS or power values).
energies: recent per-frame energy statistics, oldest→newest. Only the lastwindowentries are considered; if fewer are present, all are used.window: number of trailing frames the minimum is taken over. A larger window is more robust to sustained speech but slower to track rising noise.
Returns the estimated floor min(recent) * NOISE_BIAS, clamped to be
non-negative. Returns 0.0 for an empty slice (no evidence yet — the caller
should treat a zero floor as “unknown”, which downstream gates guard with a
tiny epsilon rather than declaring everything voiced).
Non-finite inputs (NaN/±inf) are ignored so a single bad sample cannot
poison the estimate.