When a system needs to detect or measure a single known frequency — a DTMF touch-tone, a pilot sync tone, mains-hum, or a narrowband alarm — computing a full FFT wastes every cycle spent on bins that will never be read. The Goertzel algorithm computes exactly one DFT bin using a second-order recurrence that processes samples one at a time, requiring no input buffer and no twiddle-factor table. On the smallest microcontrollers with a few hundred bytes of RAM, this distinction is decisive.
Let
Define the resonator coefficient:
The DFT sum can be reorganised as the output of a single-pole IIR filter evaluated at
After the
Separating real and imaginary parts:
The magnitude can be obtained without the final trigonometric products using the identity:
so
A physical frequency
Frequency resolution is
| Case | Time | Space | Notes |
|---|---|---|---|
| Per sample | One multiply, two adds, no table lookup | ||
| Full block | Two state words; trig only at block end |
For
Consider
| 0 | 1 | |
| 1 | 0 |
|
| 2 | -1 | |
| 3 | 0 |
Extra step:
Direct DFT check:
The recurrence pole sits exactly on the unit circle, making the filter marginally stable. Error accumulates with each block if Reset is not called between blocks. The algorithm is designed for finite, bounded blocks of exactly
Choosing
The DC bin (
The magnitude-squared form sqrt.
When several tones must be tracked simultaneously, one independent Goertzel instance per tone runs in
A sliding Goertzel variant updates one sample at a time by subtracting the oldest sample, giving a continuous output at the cost of maintaining an input ring buffer; this trades
- DTMF decoding (telephony, industrial keypads)
- Sync-tone and pilot-tone detection in radio links
- Mains-frequency monitoring (50/60 Hz hum)
- Single-bin power spectral estimation in embedded monitors
- Lock-in detection for narrow-band sensor readout
The Goertzel algorithm computes exactly the same result as one bin of the DFT computed by the Cooley-Tukey FFT (FastFourierTransform), but limits the computation to that single bin. When all PowerDensitySpectrum builds on the FFT for broadband spectral estimation. SignalDetectors provides simpler, non-frequency-selective detectors (peak hold, RMS) that cost even less per sample.
- G. Goertzel, "An Algorithm for the Evaluation of Finite Trigonometric Series," American Mathematical Monthly, 65(1), 34–35, 1958.
- A. V. Oppenheim and R. W. Schafer, Discrete-Time Signal Processing, 3rd ed., Prentice Hall, 2009, §8.1.
- P. Mock, "Add DTMF Generation and Decoding to DSP-µP Designs," EDN, March 1985 (practical embedded application of Goertzel).