48 · Spectral Domain

Windows & Spectral Leakage

Page 47 showed a pure sine spilling into neighbouring bins. Now we ask the important question: why? The answer begins with something very ordinary — we chopped out a finite block.

1 · The FFT sees a block, not an endless waveform

AUDIO
→
CUT A BLOCK
→
FFT

For interpretation, that finite block behaves as though it could repeat. If the end of one copy does not meet the beginning of the next cleanly, the implied repeating waveform contains a sudden jump.

BLOCK → REPEAT → BOUNDARY MISMATCH → DISCONTINUITY

Zero crossing is only a first intuition. What really matters is whether the beginning and end are compatible under the repeated-block view. Two endpoints can both be near zero and still have the wrong slope or phase relationship.

2 · Make the boundary problem visible

FINITE BLOCK

REPEATED BLOCK

Bin spacing46.875 Hz
Cycles in block9.387
Boundary jump—
StateOFF-BIN

Rectangular means “no taper”: every sample is weighted by 1. The other windows reshape the block before the FFT.

3 · Windowing is just MULTIPLY again

xwindowed[n] = x[n] × w[n]

WINDOW SHAPE

WINDOWED WAVEFORM

A window gives each sample in the block a weight. The centre is usually kept strong while the edges are reduced. That softens the artificial boundary created by cutting the block.

The FFT bins are not being “smoothed”. We multiply the time-domain samples before the FFT. The changed spectrum is a consequence of changing the block in time.

4 · Watch the leakage pattern change

WindowHann
Main-lobe widthwider
Distant leakagereduced
Amplitude changeyes

The vertical lines are FFT bin centres. The plotted curve is the actual DFT magnitude of the finite windowed sine block.

5 · No perfect window

WindowWhat it does wellWhat it costs
RectangularNarrowest main lobe when perfectly bin-centredStrong sidelobes / leakage when boundary mismatches
HannGood general-purpose leakage reductionWider main lobe, lower coherent amplitude
HammingLower first sidelobe than rectangularAlso widens the main lobe
BlackmanVery strong distant sidelobe suppressionEven wider main lobe / more spectral spreading near the tone

Windowing does not eliminate leakage. It redistributes it. We trade a very sharp but dirty response for a broader main lobe with lower sidelobes.

6 · Try the two revealing cases

SNAP TO BIN CENTRE
Rectangular can become extremely concentrated
MOVE OFF BIN
Rectangular leakage becomes obvious

Then keep the sine off-bin and switch to Hann, Hamming and Blackman. The tone has not changed. The measurement strategy has.

Next · We created a new problem

Overlap & Reconstruction

Great — we've faded the edges of every block. But if we're processing audio and transforming it back, those faded edges would leave holes. So how do we stitch the blocks together?

WINDOW → FFT → PROCESS → IFFT → OVERLAP / ADD

Next we'll overlap neighbouring blocks and watch their windows sum back into a continuous signal.