opyeb WaveLab

Guides · FFT

Leakage, and the windows that trade for it

Basis 28 Nov 2026 · digital signal processing · 7 min read

The DFT treats its N samples as one period of a periodic signal. If the record does not contain a whole number of cycles of a tone, the copy that follows the record starts at a different phase from the original, and the discontinuity spreads energy across every bin. That is leakage, and it is not a rounding error — a rectangular window on a half-bin offset puts only about 64 % of the peak amplitude in the largest bin.

The window is a filter on the record

Multiplying the record by a taper that falls to zero at both ends removes the discontinuity. In the frequency domain that multiplication is a convolution with the window's transform, so the ideal impulse of a bin-centred tone becomes the window's shape, centred on the tone. A narrow main lobe resolves close tones; low side lobes stop a strong tone from burying a weak one far away.

Hann: w[n] = 0.5 − 0.5cos(2πn/N), Hamming: w[n] = 0.54 − 0.46cos(2πn/N)

WindowMain lobeFirst side lobeWorst scalloping lossUse
Rectangular2 bins−13 dB−3.92 dBexact bin-centred tones
Hann4 bins−31.5 dB−1.42 dBgeneral purpose
Hamming4 bins−43 dB−1.78 dBseparating unequal tones

Scalloping

A tone halfway between two bins reads lower than a bin-centred one even after the window. With a rectangular window the drop is 3.92 dB; with Hann it is 1.42 dB. This is scalloping loss, and it is why a level readout from an un-interpolated spectrum can be wrong by several decibels even though the transform is exact.

Parabolic interpolation on the log magnitudes fixes most of it. WaveLab interpolates the peak position and reads the level after correction, so a 440 Hz tone at 48 kHz with N = 2048 reports within a few hertz and a few tenths of a decibel.

Hann against Hamming

Both have a four-bin main lobe, so neither resolves closer tones than the other. Hann reaches zero at the edges, which makes it smooth for overlap-add and gives side lobes that fall off quickly (−18 dB per octave). Hamming does not reach zero — it is 0.08 at the edges — which puts its first side lobe 11.5 dB lower but leaves its far side lobes flatter. For a spectrum display Hann is usually the better default; for a strong tone next to a very weak one, Hamming can help.

The studio's default is Hann at N = 2048. Switch to Rectangular with the two tones 30 Hz apart and the leakage skirt around each peak becomes visible immediately.

What no window can fix

If two tones are closer than the main lobe width — roughly 2·fs/N for rectangular, 4·fs/N for Hann — no window separates them at that record length. The answer is a longer record, not a cleverer taper. At 48 kHz, 30 Hz apart needs N ≈ 6 400 with Hann, which is why the bench stops at 4 096 and the pair looks like one hump there.

Questions

Does a window change the measured frequency?

It biases the peak slightly: Hann pulls a bin-centred tone by about 0.01 bins, which is negligible after interpolation. The bigger effect is on amplitude, through scalloping loss.

Why not always use the flattest window?

Flat-top windows have almost no scalloping loss but a very wide main lobe, so they blur close tones. Every window is a choice between resolution, leakage and amplitude accuracy.

In the analyser set 440 Hz and 470 Hz, then cycle the three windows at N = 2048 and 4096.

Open the studio

Written from standard Fourier analysis, digital signal processing and acoustics; the worked numbers can be reproduced in the studio linked above.

Back to the guides