Field Guide · algorithm

Also known as: Goertzel algorithm, Goertzel filter

The Goertzel algorithm computes the value of a single DFT bin using a small recursive filter, so a receiver can measure the energy at one chosen frequency without running a full FFT.1 It behaves like a sharply tuned second-order resonator that is run over a block of samples; when only a handful of target tones matter, it is dramatically cheaper than transforming the whole spectrum and then throwing most of it away.

x[n] + delay z^-1s[n-1] delay s[n-2] magnitude at f0 |X(f0)|^2 2cosω
Goertzel runs a two-state resonator over the samples; after N inputs a short final step yields the magnitude at the one target frequency f0.

How it works

For a target bin k (frequency f0 = k·fs/N), define the coefficient c = 2·cos(2πk/N). The algorithm keeps two running state variables and, for each incoming sample x[n], updates them with a single recurrence:

s[n] = x[n] + c·s[n-1] − s[n-2].

This is a two-pole IIR-like resonator whose poles sit right on the unit circle at the target frequency, so it accumulates energy there. After processing all N samples, one short closing computation combines the two final states into the complex DFT value X[k], from which magnitude (and, if wanted, phase) is read. Only the final step needs the complex twiddle factor; the inner loop is a real multiply-add, making the per-sample cost tiny.

  • Cost. Detecting M tones costs about M·N real multiply-adds, versus N·log₂N for a full FFT. When M is small — a few DTMF tones, one sub-audible squelch tone — Goertzel wins outright and needs no large buffer or bit-reversal.
  • Resolution and duration. The effective bandwidth of the detector still follows fs/N, so a longer block gives a narrower, more selective response but a slower answer. Choosing N so the target lands exactly on a bin centre maximises the response and minimises leakage.
  • Off-grid tones. Frequencies that fall between bins are still detected but with a slightly reduced, phase-dependent magnitude; a generalized Goertzel with a non-integer k recovers arbitrary frequencies exactly.

In practice

Goertzel is the classic choice for DTMF decoding: the eight keypad tones map to eight parallel Goertzel detectors, and a valid digit is declared when exactly one row tone and one column tone exceed threshold with the right energy ratio. The same pattern detects continuous control tones — CTCSS/”PL” sub-audible squelch tones, selective-calling (SelCal) tones, and single-frequency signalling — where the receiver only ever cares about a fixed, small list of frequencies. Because the inner loop is so light, it is a staple on microcontrollers and DSPs that could not afford a streaming FFT.

Relevance to SDR

In SDR pipelines Goertzel appears wherever a decoder must watch for a specific tone rather than survey the band: sub-audible squelch-tone recognition on analog voice channels, MDC and tone-signalling front ends, and quick presence/absence energy detection at known control frequencies. It complements — rather than replaces — the FFT that drives full spectral displays.

GopherTrunk’s primary targets are digital trunking protocols, which it decodes with matched filtering and symbol recovery rather than tone banks, so a Goertzel stage is not central to those chains. It remains the standard, well-understood tool for the analog tone-detection tasks (CTCSS, DTMF) that sit alongside digital scanning, and is worth reaching for any time only a few frequencies matter.

Sources

  1. Goertzel algorithm — Wikipedia, on the recursive single-bin DFT resonator and its use in tone detection. 

See also