home/ atoms/ fft-windowing

FFT analysis of real sounds requires windowing to reduce spectral leakage from discontinuous segment boundaries

The FFT assumes its N input samples represent exactly one period of a periodic signal. When a real sound segment does not align perfectly with the FFT window (i.e., doesn’t complete an exact integer number of cycles), the abrupt jump at the boundary causes energy to ‘leak’ across many frequency bins — spectral leakage. A windowing function (Hamming, Hann, Blackman, etc.) is multiplied pointwise with the input signal before FFT, tapering the signal to zero at both ends and eliminating the boundary discontinuity. This reduces leakage at the cost of slightly widening spectral peaks. Windowing is necessary whenever the FFT length is not matched to the signal’s period, which is almost always the case for real-world audio analysis.

Examples

Analyzing a 220 Hz sine wave with a 4096-sample window at 44100 Hz: 4096/44100 ≈ 0.0929 s, which contains ~20.44 cycles — not an integer. Without windowing, severe leakage. With Hamming window: clean peak with attenuated sidelobes. When to skip windowing: analyzing a perfectly looped synthesizer sample where the loop length is known and exact.

Assessment

Explain in your own words why spectral leakage occurs in FFT analysis of real sounds. What does a windowing function do to reduce leakage, and what is the trade-off? When can you safely skip windowing?

“force the ends to line up is to preprocess the data so that itdies away to zero at both ends. Then, no matter what the underlying periodicity,there will be no abrupt changes in the waveshape.”
corpus · tuning-timbre-spectrum-scale-william-a-sethares · chunk 108