Skip to main content

goertzel

Function goertzel 

Source
pub fn goertzel(x: &[f64], k: f64) -> Result<Complex<f64>, ErrorsJSL>
Expand description

The DFT of x at one (possibly non-integer) bin k, X(k) = Σ x_n e^{−2πi k n / N}, by the generalised Goertzel recursion s_n = x_n + 2cos(ω) s_{n−1} − s_{n−2} (ω = 2πk/N) and a final phase correction. Costs one real multiply-add per sample, so it beats an FFT when only a few bins are needed (tone detection).