Spectrum analyzer basics · Guide
FFT explained simply
An FFT takes a piece of sound, or any signal, and tells you which frequencies are inside it and how strong each one is. It is the engine behind every digital spectrum analyzer, every spectrogram and a lot of the technology in your phone. You do not need the maths to understand it. Start by moving the sliders below: you build a wave out of three sine waves, and the FFT pulls them apart again.
Try it
Each row is one sine wave. The top graph is what you would see on an oscilloscope: all three added up. The bottom graph is the FFT of that sum: one peak per sine wave.
The idea in one picture
Think of a smoothie. You can taste that it is sweet and sour, but you cannot see the fruit any more. The FFT works out the recipe: so much banana, so much lemon. For sound, the ingredients are pure sine waves, each with its own frequency and strength.
How does it find them? For each frequency it wants to test, the FFT takes a perfect sine wave at that frequency and lines it up against the sound, sample by sample. If the sound contains that frequency, the two move together and the match adds up to a big number. If not, the ups and downs cancel out and the total comes close to zero. Do that for every frequency slot and you have the spectrum.
The clever part is speed. Testing thousands of frequencies one by one is slow, and the FFT shares the work between them, so a phone can do it dozens of times a second for live sound. Try the "Square-like" example above: three sines at 300, 900 and 1,500 Hz already make a wave with flat-ish tops, and the FFT still finds each one.
One FFT describes one block of sound as a whole. It tells you what was in the block, not when inside the block it happened. For sound that changes, such as speech or music, analyzers run one FFT after another, many times a second, and show the newest result. Stack those results side by side as columns of colour and you get a spectrogram, which shows frequency and time together.
From samples to bins
A computer never sees a smooth wave. It sees samples: the level of the sound measured many times a second. The sample rate says how often: 48,000 times a second is common, so 1 second of sound is 48,000 numbers. The highest frequency those samples can hold is half the sample rate, 24 kHz, called the Nyquist frequency.
The FFT works on a block of samples at a time. The number of samples in a block is the FFT size, usually a power of two such as 4,096 or 8,192, because the fast method splits the block in half again and again. Out of a block of N samples come N ÷ 2 + 1 frequency slots, called bins, evenly spaced from 0 Hz up to the Nyquist frequency.
The bin width is the sample rate divided by the FFT size. With 48 kHz and 8,192 samples each bin is 5.86 Hz wide, so the result says how much sound there is around 0 Hz, around 5.86 Hz, around 11.7 Hz, and so on up to 24 kHz. A tone at 440 Hz lands in bin 75.
Real tones rarely sit exactly on a bin. Bin 75 is centred on 439.5 Hz and bin 76 on 445.3 Hz, so a 443 Hz tone shares its energy between the two. A good analyzer does not stop at the tallest bin: it looks at the shape of the peak across the neighbouring bins and works out the true frequency to a small fraction of a bin. That is how a tuner can read a note to within a cent even though its bins are several hertz wide.
| FFT size (48 kHz) | Bin width | Block length | Bins up to 24 kHz |
|---|---|---|---|
| 1,024 | 46.9 Hz | 21 ms | 513 |
| 4,096 | 11.7 Hz | 85 ms | 2,049 |
| 8,192 | 5.86 Hz | 171 ms | 4,097 |
| 32,768 | 1.46 Hz | 683 ms | 16,385 |
Each bin holds two numbers: how strong that frequency is (the magnitude) and where it is in its cycle (the phase). Spectrum analyzers show the magnitude, usually in decibels, and ignore the phase. To work these numbers out for any sample rate and size, use the FFT calculator.
Why windows are needed
The FFT quietly assumes that the block it gets repeats forever, end joined to start. Real sound does not fit that neatly. A 1,000 Hz tone in a block of 8,192 samples at 48 kHz fits 170.67 cycles, not a whole number, so where the end meets the start there is a jump. The FFT sees that jump as extra frequencies and smears some of the tone's energy into the bins around it. This is called spectral leakage.
A window fixes most of it. Before the FFT, each block is faded in and out, so both ends are near zero and nothing jumps. The most used window, Hann, is shaped like a smooth hill. Without a window, a loud tone's skirt is still only about 40 dB down 200 Hz away and can bury quiet sounds nearby. With Hann, it is around 100 dB down.
Nothing is free: a window makes each peak a little wider, so two very close tones are harder to split. Different windows choose different balances between sharp peaks, low skirts and exact levels. The page on window functions compares them. The demo above uses Hann, which is why its peaks look clean even when a slider lands between two bins.
Time vs frequency detail trade-off
A bigger FFT gives finer bins, but it needs a longer block of sound. At 48 kHz, 32,768 samples give 1.46 Hz bins, fine enough to split 50 Hz hum from its neighbours, but the block lasts 683 ms. Everything that happens inside that time is mixed together. A drum hit of 50 ms becomes a short blip inside a long average.
A small FFT is the opposite. With 1,024 samples the block is only 21 ms, so you see each drum hit, but the bins are 46.9 Hz wide and two notes a semitone apart merge into one. You cannot have both at once; this is a basic property of signals, not a weakness of the FFT.
In practice you pick the size by the job: big for steady tones, hum and tuning, small for speech, beats and fast changes. Spectrograms add overlap, starting a new block before the last one ends, so the picture updates more often, but each column still covers the full block. With 75 % overlap, a 4,096-sample FFT at 48 kHz gives a new column every 21 ms while each column still looks at 85 ms of sound. Adding zeros to a short block (zero-padding) gives a smoother curve, not more real detail. The "Two close tones" example shows the other side: 440 and 450 Hz are two clear peaks with the 16,384-sample FFT this demo uses (2.93 Hz bins), and the wave above them swells and fades 10 times a second.
Where FFT is used
- Audio: spectrum analyzers, EQ and noise-reduction plugins, pitch detection in tuners and the music-recognition apps that match songs by their spectrogram.
- Radio: the waterfall of every software-defined radio, and Wi-Fi, 4G and 5G, which build their signals with an inverse FFT and take them apart with an FFT.
- Images and medicine: MRI scanners turn their raw data into pictures with a two-dimensional FFT, and JPEG photos use a close cousin, the discrete cosine transform.
- Phones and machines: voice calls, vibration checks on motors and bearings, and earthquake sensors.
The FFT also works backwards. An inverse FFT turns a spectrum back into a wave, so a program can take sound apart, change some frequencies and put it back together. Many noise-reduction tools do exactly this: they learn the spectrum of the hiss, turn those bins down in every block and rebuild the sound. Fast convolution, used for reverb plugins that recreate real rooms, relies on the same trick.
A tiny bit of maths
This part is optional. The discrete Fourier transform of N samples x[n] gives, for each bin k:
X[k] = Σ x[n] · e−j2πkn/N, summed over n = 0 to N − 1.
In words: multiply the samples by a test wave that makes k full cycles in the block, and add up the results. That is the matching idea from the picture above. Done directly, every bin needs N multiplications, so all bins need N × N. For 32,768 samples that is over a billion steps.
The FFT, published by Cooley and Tukey in 1965, splits the block into even and odd samples again and again, and reuses the pieces. It needs about N × log2 N steps: 491,520 for 32,768 samples, about 2,000 times fewer. Same answer, far less work. To build waves from sines yourself, open the Fourier playground; for more lessons, see spectrum analyzer basics.
FAQ
What does FFT stand for?
Fast Fourier Transform: a fast way to work out which frequencies make up a signal.
What is an FFT bin?
One frequency slot of the result; its width is sample rate ÷ FFT size. At 48 kHz and 8,192 points each bin is 5.86 Hz wide.
Why is it called fast?
It needs about N·log N steps instead of N², so a 32,768-point FFT is thousands of times faster than the plain method.
Is FFT the same as Fourier transform?
It is an algorithm that computes the discrete Fourier transform quickly. The answer is the same; only the work needed is smaller.