The STFT window length trades time resolution against frequency resolution and cannot give both at once
The short-time Fourier transform analyses a signal by applying an FFT to successive overlapping windows to produce a spectrogram. The window length forces an unavoidable trade-off: a short window locates fast events accurately (good time resolution) but yields wide frequency bins that blur close frequencies (poor frequency resolution); a long window resolves close frequencies (narrow bins) but smears transients across its duration (poor time resolution). Frequency resolution per bin equals the sample rate divided by the FFT size, so improving one resolution necessarily worsens the other — this is the STFT form of the Gabor uncertainty principle (the same principle that governs grain duration in granular synthesis) and cannot be circumvented by any windowed analysis. Overlap between successive frames (typically 50–75%) sets how densely the spectrogram is sampled in time. To avoid spectral leakage from abruptly truncated windows, taper each window to zero at both ends with a smooth window function (Hann, Hamming, Blackman) rather than a rectangular cut. Window length is therefore a fundamental parameter in spectral processing, pitch detection, and vocoder design.
Examples
At 44.1 kHz: a 64-sample window → ~690 Hz per bin (sharp time, blurry frequency); a 1024-point FFT → ~43 Hz per bin and ~23 ms per frame at 50% overlap; a 4096-sample window → ~10.8 Hz per bin but ~93 ms temporal blur, unsuitable for sharp percussive onsets. Reaching 1 Hz frequency resolution needs a window ≥ 1 second (44,100 samples), giving time precision of only about ±0.5 s. A typical music balance: 1024–2048 samples with 75% overlap.
Assessment
Given a 44.1 kHz sample rate and a 2048-point FFT, compute the frequency resolution per bin and state how doubling the FFT size affects both time and frequency resolution. Then explain why you cannot detect a snare’s precise onset time (to ~2 ms) and measure its fundamental (to ~5 Hz) with a single STFT window size, and what compromise you would choose.