The FFT

intermediate

Time domain vs frequency domain, what an FFT shows, how bin width sets frequency resolution, and why windowing matters.

The idea

There are two ways to look at any signal. The time domain shows amplitude changing over time — like watching ocean waves go up and down, or the wiggly line of a voice recording. The frequency domain shows which frequencies are present and how strong each one is — like seeing the sheet music instead of hearing the song. A piano chord looks like one messy wiggle in time, but in frequency it is three clean peaks, one for each key pressed.

The Fast Fourier Transform (FFT) is the algorithm that converts between the two. Think of it as magical glasses that reveal the frequencies hidden inside any signal — music, radio waves, even your heartbeat. Feed it a recording of a C major chord and it shows peaks at 261.6 Hz (C4), 329.6 Hz (E4), and 392.0 Hz (G4). Feed it a slice of the 2.4 GHz band and it exposes your neighbor's WiFi, Bluetooth hops, and the microwave oven leaking at 2.45 GHz. Every spectrum analyzer display you will ever see is an FFT under the hood.

Technically the FFT is a fast recipe for the Discrete Fourier Transform: same result, but O(N log N) instead of O(N²) operations, which is why real-time spectrum displays are possible at all. Its output is complex: a magnitude (how strong each frequency is) and a phase (when it starts) for every frequency bin.

The FFT chops the spectrum into bins, and the bin width sets what you can distinguish. Analyze more time and you get finer frequency resolution — a fundamental trade: long captures resolve close-together tones but smear fast changes; short captures react quickly but blur the frequency axis.

The math

For a signal sampled at rate f_s and analyzed with an N-point FFT, the frequency resolution (bin width) is:

Δf=fsN\Delta f = \frac{f_s}{N}

Example: audio sampled at 44.1 kHz with a 4096-point FFT gives bins about 10.8 Hz wide — narrow enough to separate adjacent musical notes. Doubling N halves the bin width but requires twice as much signal, so it doubles the time you must wait.

One paragraph on windowing: the FFT quietly assumes your captured slice repeats forever, and if the slice does not begin and end cleanly, the artificial seams smear energy across the spectrum — an effect called spectral leakage. A window function (Hann is the everyday choice) fades the slice in and out at its edges, dramatically reducing the smear at the cost of slightly wider peaks. Different windows trade peak sharpness against leakage suppression, which is why analyzers let you choose.

Common misconceptions

  • Myth: The FFT changes or filters the signal. Reality: It is only a change of viewpoint — the same information displayed against frequency instead of time. The inverse FFT gets the original back exactly.
  • Myth: More FFT points always means a better answer. Reality: Finer bins need a longer capture, so you lose the ability to see fast changes. Resolution in frequency is paid for with resolution in time.
  • Myth: A peak between two bins is lost. Reality: Its energy spreads into neighboring bins (leakage). Windowing and interpolation manage this — but nothing recovers detail finer than the bin width.

Try it

Open the FFT Analyzer, create a 1000 Hz sine wave, add a 2000 Hz harmonic, and run the transform — one messy time-domain wiggle becomes two clean peaks. Then change the FFT size and watch the peaks sharpen as the bins narrow.