The DFT treats a frame as if it repeats forever. If the frame does not hold a whole number of cycles, its two ends do not join smoothly, and that jump spreads energy into many frequency bins. This is spectral leakage. A window function fades the ends of the frame to reduce it. The same windows are used to design FIR filters in 18 Windowing Method.
Why It Happens
- cutting out a frame is the same as multiplying the signal by a rectangular window
- multiplication in time is convolution in frequency, so every true tone is spread out by the window's own spectrum
- a rectangular window's spectrum is a sinc, whose first side lobe is only 13 dB below the peak
- so a strong tone leaks into nearby bins and can hide a weaker tone
Main Lobe Versus Side Lobes
What each one controls:
- main lobe width: how close two tones can be and still be told apart (resolution)
- side lobe level: how far a strong tone leaks into other bins (dynamic range)
- lower side lobes always cost a wider main lobe
| Window | Highest side lobe | Main lobe |
|---|---|---|
| Rectangular | about dB | narrowest |
| Hann | about dB | wider |
| Hamming | about dB | wider |
| Blackman | about dB | wider still |
| 4-term Blackman-Harris | about dB | widest of these |
4-Term Blackman-Harris
- , , ,
- a good choice when a weak signal must be seen next to a strong one, for example a weak WiFi channel beside a strong transmitter on the next channel
Practical Points
- a window lowers the total power in the frame, so scale by the window's average value if absolute levels matter
- subtract the frame's mean before windowing, otherwise any DC turns into a wide bump at 0 Hz
- zero-padding makes the spectrum look smoother but does not improve resolution, only a longer frame does