Skip to main content

Module goertzel

Module goertzel 

Source
Expand description

The Goertzel algorithm for single DFT bins.

See the book entry Spectra at chosen frequencies: Goertzel, chirp-z and Fourier integrals.

Functions§

goertzel
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).
goertzel_frequency
The DFT at frequency f (Hz) of x sampled at fs.
goertzel_power
|X(k)|² at bin k without the final complex rotation: s_{N−1}² + s_{N−2}² − 2cos(ω) s_{N−1} s_{N−2}.