Fast Fourier Transform (FFT) in Audio: How Spectral Visualizers Work
Every real-time spectrum analyzer, parametric EQ display, and audio visualizer relies on the Fast Fourier Transform (FFT) algorithm, developed in 1965 by J.W. Cooley and John Tukey to compute the Discrete Fourier Transform (DFT) in \(O(N \log N)\) operations.
Time Domain vs Frequency Domain
An audio file stored on disk exists in the time domain: a series of amplitude values over time. The Fourier transform mathematically decomposes this complex waveform into an infinite sum of constituent sine and cosine waves, revealing the amplitude and phase of each frequency band (the frequency domain).
FFT Windowing & Frequency Resolution
Because real-time audio is continuous, the incoming stream is sliced into discrete chunks called window frames (e.g. 1024, 2048, or 4096 samples). Windowing functions (such as Hann, Blackman, or Hamming) taper the edges of the buffer to zero, preventing spectral leakage artifacts.
The frequency resolution of each analyzer bin is governed by: