Peak interpolation: hertz from a coarse grid
A spectrum display can only put a marker on a bin, but the tone is rarely on a bin. The gap between the two is the whole subject of frequency estimation: given the three magnitudes around the maximum, how much better than one bin can we do?
The parabolic estimator
Fit a parabola y = ax² + bx + c through the log-magnitudes at bins k−1, k and k+1 and take its vertex. The offset from the peak bin is a simple ratio of the neighbouring differences, and the estimated frequency is (k + δ)·fs/N.
δ = ½·(y[k−1] − y[k+1]) / (y[k−1] − 2y[k] + y[k+1])
For a Hann-windowed tone this is accurate to about ±0.02 bins when the tone is at least half a bin from the edge of the main lobe, which is almost always. At N = 2048 and 48 kHz that is ±0.5 Hz. Without interpolation the worst case is ±11.7 Hz.
| Tone at 48 kHz, N = 2048 | Nearest bin | No interpolation | With parabola |
|---|---|---|---|
| 440.0 Hz | bin 19 (445.3 Hz) | −5.3 Hz error | ±0.4 Hz |
| 1000.0 Hz | bin 43 (1007.8 Hz) | −7.8 Hz error | ±0.5 Hz |
| 440.5 Hz (near boundary) | bin 19 | −4.8 Hz error | ±1.1 Hz |
Why the log domain
The main lobe is close to a Gaussian in decibels, not in linear magnitude. Interpolating the log values therefore tracks the true peak better, especially for tapered windows. Linear interpolation biases the estimate towards the peak bin and is noticeably worse for Hann.
Bias and the window
Every window has a small systematic bias: a tone exactly halfway between bins reads a fraction of a bin low. Hann's bias is under 0.01 bins for the parabola, Hamming's is similar, and the rectangular window's is larger because its main lobe is sharper and less parabolic. WaveLab reports the corrected frequency, so the remaining error is dominated by noise rather than by the estimator.
The limit is information, not arithmetic
The Cramér–Rao bound for a single tone in white noise sets how precisely frequency can be estimated from a record of length T at a given SNR. At 42.7 ms and 60 dB SNR the bound is well under 1 Hz; at 10 dB SNR it is a few hertz. Interpolation reaches that bound, which is why the readout is stable at high SNR and jitters when the noise slider goes up — that jitter is the physics, not the code.
In the analyser, set one tone to 440 Hz with noise at −100 dBFS and watch the peak readout settle at 440.0 Hz; raise the noise to −30 dBFS and it will wander by a hertz or two.
Questions
Can interpolation separate two tones closer than a bin?
No. Interpolation locates one peak; it does not create resolution. Two tones within the main lobe produce one peak whose position is between them, which is worse than useless if you believe it.
Does zero padding improve the estimate?
It makes the parabola easier to compute accurately, because the samples around the peak are closer together, but the underlying uncertainty is unchanged. The gain is in convenience, not in accuracy.
Enter 441 Hz with noise at −100 dBFS: the peak reads within half a hertz on a grid whose bins are 23.4 Hz apart.
Open the studioWritten from standard Fourier analysis, digital signal processing and acoustics; the worked numbers can be reproduced in the studio linked above.
Back to the guides