detect_vuv_and_sa

Function detect_vuv_and_sa 

Source
pub fn detect_vuv_and_sa(
    fft_out: &[Complex<f32>],
    f0_bin: f32,
    state: &mut VuvState,
    e_p: f32,
) -> (VuvDecisions, SpectralAmplitudes)
Expand description

Integrated V/UV + spectral amplitude extraction.

Ports OP25’s v_uv_det. For each harmonic k ∈ 1..=num_harms, extracts the analysis window [k·f0 − f0/2, k·f0 + f0/2] from the FFT, fits a windowed sinusoid, and accumulates error and energy. Every HARMS_PER_BAND harmonics, commits a band decision based on Dk = D_num / D_den < dsn_thr.

e_p is the current-frame pitch-error metric (output of the pitch tracker); passing a large value (> 0.55) disables voicing in all but the first band — the pitch quality is too low to trust the harmonic model.