Cut a finite block out of an infinite signal and you have already multiplied it by a rectangle — and that rectangle rings. Its sharp edges smear every tone across the whole spectrum, so a weak tone beside a strong one is drowned in leakage. Taper the edges to zero before you transform and the ringing collapses: you trade a little frequency resolution for far less leakage. The blue team builds the four classic windows and defends the tradeoff; the red team attacks the cost and tries to hide a masked tone.
source F. J. Harris, On the Use of Windows for Harmonic Analysis with the Discrete Fourier Transform, Proc. IEEE 66(1), 1978, pp. 51–83 — doi.org/10.1109/PROC.1978.10837 (AMBER — stable DOI, paywalled). Rendered, not quoted.
A window is a length-N taper w[n] multiplied onto the block before the DFT. The classic four (with M = N−1):
rect w=1 · hann 0.5(1−cos 2πn/M) · hamming 0.54−0.46cos · blackman 0.42−0.5cos+0.08cos2
Live, computed for N=32 — narrow main lobe = sharp resolution; low side lobes = little leakage. You cannot have both:
| window | peak side lobe | main-lobe null | coh. gain |
|---|
Harris 1978 cataloged the windows and their exact numbers. The lesson folds forward: a window is the pre-processing before every transform. Multiply your block by w[n], then hand it to the-fourier spectrum or the-goertzel single-bin probe.
Rectangular is just "no window" — the default you never chose. Every leakage artifact downstream is the rectangle's sharp edges ringing. Each sphere is the next one's input, tapered.
The blue team's live check: recompute the rectangular and Hann side-lobe levels, the Hann endpoints, and the distant-bin leakage — and confirm them against the known physics. If red swaps the taper, this badge is where it shows.
Feed the machine a block of N=128 samples holding two sinusoids at non-integer bin positions (the honest, worst case): a strong tone at bin 20.5, amplitude 1 (0 dB), and a weak tone at bin 28.5, amplitude 0.01 (−40 dB).
Because the tones fall between bins, a bare DFT (rectangular window) smears the strong tone's energy across every bin — its leakage skirt can rise above the weak tone and hide it. The window is what you multiply in before the transform to stop that.
Top: the window shape w[n] (taper). Middle: its spectrum in dB — the main lobe and side lobes. Bottom: the two-tone block through this window — can you see the −40 dB weak tone?
A tone burst gated by this window (smooth) vs a rectangular gate (clicks at the edges — those clicks are the side-lobe leakage, made audible).
Change the window — every number and curve is computed live from w[n] by DFT on the spot, never looked up.
What the machine produces, proven: the rectangular window has the narrowest main lobe but a peak side lobe of only −13 dB — its leakage floor sits above a −40 dB tone, so the weak tone is masked. The Hann window widens the main lobe ~2× but drops the peak side lobe to −31 dB and its leakage floor falls below −80 dB — the weak tone stands clear.
Resolution vs leakage: the whole catalog is points on that curve. The witness (left) confirms these numbers live; the red team (right) tries to make a masked tone look found.
More: scalloping loss — an off-bin tone reads up to 3.9 dB low (1.4 dB for Hann); processing gain is lost to the noise floor; and a window cannot add information — it only reshapes the leakage you already have. The right window is a per-application choice, not a universal upgrade.
"A window removes spectral leakage." Cut. It redistributes leakage — trading a tall narrow main lobe for low far side lobes. Total energy is conserved; nothing is removed.
"Hamming beats Hann — lower side lobes always win." Kept, corrected. Hamming's peak side lobe (−42 dB) beats Hann's (−31), but Hann's side lobes roll off faster (18 dB/oct vs 6). Far from the tone, Hann is cleaner. "Best" depends on where you look.
"It's the Hanning window." Cut. It is von Hann's window (Julius von Hann); "hanning" is a verb Blackman & Tukey coined by analogy to "hamming". The name is a folk error.
The red team's move: apply a rectangular window but label it Hann. No taper, side lobes stay at −13 dB — the weak tone stays masked while the readout claims a low-leakage taper. The blue team's witness (window 7) is watching.
Swap the taper for a flat rectangle while still calling it Hann: the side lobes jump back to −13 dB, the endpoints stop tapering to 0, the witness recomputes, disagrees with the known Hann numbers, and turns red. Nothing is faked; the attack is real and it is caught.