DSP 101
M5 · Lab
Hands-on lab
See a tone land in a bin

Compute the DFT of a single tone in the sandbox, and predict — before you read it off the screen — the exact bin the tone lands in, the frequency that bin represents, and what zero-padding does to the spacing between bins.

The Discrete Fourier Transform
X[k] = \sum_{n=0}^{N-1} x[n]\, e^{-j 2\pi k n / N}

The DFT turns N samples into N frequency bins spaced f_s/N apart. Knowing which bin a tone lands in — and that zero-padding buys finer bin spacing but never finer resolution — is the difference between reading a spectrum and being fooled by one.

1 / 7
DSP 101
M5 · Lab
Set it up
One tone

Open the sandbox. It opens on exactly this state — a single tone in bin 10 — so a Reset gets you here too. Each step names the one knob to change; leave everything else alone.

Set these values
Tone 1 -> bin 10 N -> 64 f_s -> 48000 Hz Window -> default Zero-padding -> 1x (change only in Step 3)

Watch the peak readout and the frequency-axis labels in panel 2 — every number you predict is printed there.

2 / 7
DSP 101
M5 · Lab
Step 1 of 3
What frequency is bin 10?

Keep the defaults: tone 1 in bin 10, N = 64, f_s = 48000 Hz. Bin k sits at k·f_s/N. Predict the Hz for bin 10, then read the peak readout.

Expected

The peak sits at k·f_s/N = 10 · 48000 / 64 = 7500 Hz — the centre frequency of bin 10.

3 / 7
DSP 101
M5 · Lab
Step 2 of 3
How tall is the peak?

Still the single unit-amplitude tone, sitting exactly on bin 10. The spectrum is calibrated for the window's gain, so a bin-centred unit tone reads the same height whatever window you pick. Predict the peak level in dB, then read it.

Expected

The peak reads 0 dB: a coherently-sampled unit tone puts all its energy in one bin, and the window-gain correction makes that bin read exactly 0 dB.

4 / 7
DSP 101
M5 · Lab
Step 3 of 3
Zero-pad, and watch the spacing

Set Zero-padding to 4x, so the transform length is L = N·4 = 256. Predict the new bin spacing f_s/L, then read it — and notice the resolution f_s/N = 750 Hz has not changed.

Expected

The bin spacing drops to f_s/L = 48000 / 256 = 187.5 Hz, but the resolution stays f_s/N = 750 Hz. Zero-padding interpolates between bins; it does not resolve anything finer.

5 / 7
DSP 101
M5 · Lab
Your turn
Open the sandbox

Everything above is waiting in the sandbox. Add a second tone and watch two peaks, sweep a tone off a bin centre to see the leakage, change the window, and drag the zero-padding to watch the spacing shrink while the resolution holds.

6 / 7
DSP 101
M5 · Lab
Wrap-up
What you did
  • Placed a tone in bin 10 and read its frequency, k·f_s/N = 7500 Hz
  • Confirmed the calibrated peak of a bin-centred unit tone reads 0 dB
  • Zero-padded to 4x and watched the bin spacing shrink to 187.5 Hz while resolution held at 750 Hz
  • Every value you predicted is the demo's own DFT arithmetic, not a picture
7 / 7
1 / 8 muted