47 · Spectral Domain

FFT Size, Bins & Resolution

Last page gave us frequency bins. Now let's make the buckets visible. How far apart are they — and what happens when a real frequency lands between them?

1 · BIN = bucket

An FFT does not give us an infinitely continuous frequency ruler. It gives us discrete frequency positions.

bin spacing Δf = sample rate fs ÷ FFT size N

At 48 kHz with a 1024-point FFT:

48,000 ÷ 1024 = 46.875 Hz per bin
The bins are measurement positions — not notes that the audio is forced to play. A sine can move smoothly between them. The FFT then has to describe that frequency using the available bins.

2 · Watch a smooth sine travel across the buckets

Bin spacing46.875 Hz
Nearest bin9
Bin centre421.875 Hz
Offset from centre+18.125 Hz

The audio oscillator itself remains continuous. The vertical lines are the FFT's discrete measurement positions. The blue distribution is an idealised rectangular-window FFT response around the sine, shown to make the bin behaviour obvious.

3 · Put the sine exactly ON a bin

If the analysed block contains an integer number of cycles, a stationary sine can align exactly with one FFT bin under a rectangular window. Its energy becomes highly concentrated.

Listen: snapping changes the oscillator only slightly. Watch what happens to the spectral buckets.

fk = k × fs / N

Move it slightly off the centre. The sine itself is still perfectly valid. But it no longer fits neatly into the finite analysis block, so its energy spreads across neighbouring bins. This is the beginning of spectral leakage.

4 · Bigger FFT → narrower frequency spacing

FFT size @ 48 kHzBin spacingBlock duration

More samples give us more closely spaced frequency measurements. Two nearby tones that blur together in a small FFT may become distinguishable in a larger one.

SMALLER N
coarser frequency spacing
shorter time block
LARGER N
finer frequency spacing
longer time block

5 · The trade-off appears again

MORE SAMPLES
→
LONGER LOOK AT TIME
→
FINER FREQUENCY SPACING

At 48 kHz, a 256-point FFT sees only about 5.33 ms at once. A 4096-point FFT sees about 85.33 ms. That extra time helps separate nearby frequencies — but it also means the analysis describes a longer chunk of a signal that may be changing.

This is the time/frequency trade-off beginning to reveal itself. Better frequency discrimination requires observing the signal for longer.

6 · Why does the energy spill?

Remember: the FFT sees a finite block. Conceptually it treats that block as one period of something that could repeat. If the end does not join the beginning cleanly, the implied repetition contains a discontinuity.

OFF-BIN SINE
→
BLOCK BOUNDARY MISMATCH
→
ENERGY ACROSS BINS

We could try to wait for magically perfect boundaries — but real music will not cooperate.

Next · Solve the boundary problem

Windows & Spectral Leakage

Instead of demanding that every signal fit perfectly into our block, we deliberately shape the block edges before the FFT.

xwindowed[n] = x[n] × w[n]

We'll deliberately make a sine leak, then switch between Rectangular / Hann / Hamming / Blackman and see exactly what each window changes — and what it costs.