Goertzel algorithm
A cheap way to compute one DFT bin, one multiply per sample.
The Goertzel algorithm computes a single DFT bin with the recurrence s_n = x_n + c s_{n-1} - s_{n-2}, c = 2cos(2πk/N), and |X_k|² = s_{N-1}² + s_{N-2}² - c s_{N-1} s_{N-2}.
Examples
Goertzel computes just the fan's 23 Hz bin with one multiply and two adds per sample and two numbers of state, cheaper than a full FFT.
On the ESP32-S3 the Goertzel loop runs in
float; on the ESP32-C6, with no floating-point unit, it runs in Q15.
See also