DSP 101
M2 · Lab
Hands-on lab
Sample a tone, watch it fold

Sample a single tone and watch its spectrum in the sandbox, and predict — before you read it off the screen — the exact frequency the tone appears at, and when the anti-alias filter is what saves it.

The fold (alias) frequency
f_{\text{alias}} = \left| f - f_s \cdot \operatorname{round}\!\left(\frac{f}{f_s}\right) \right|

Aliasing is the one sampling mistake you cannot undo afterwards: once a 12 kHz tone has folded down to 4 kHz, no filter on the samples can tell it apart from a real 4 kHz tone. Seeing exactly where a tone lands — and seeing the anti-alias filter stop the fold before it happens — is the whole reason the sampling theorem matters.

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

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

Set these values
Waveform -> Single tone fs -> 16000 Hz Filter before sampling -> off (turn on only in Step 3)

Watch the Nyquist frequency readout and the marked fold in panel 2 — every number you predict is printed there.

2 / 7
DSP 101
M2 · Lab
Step 1 of 3
A tone below Nyquist

Keep the defaults: f = 1500 Hz, f_s = 16000 Hz, filter off. Since f is well below f_s/2, predict where the tone lands in the sampled spectrum, then read it.

Expected

The sampled spectrum shows the tone still at f_alias = 1500 Hz — below the Nyquist frequency f_s/2 = 8000 Hz, so nothing folds.

3 / 7
DSP 101
M2 · Lab
Step 2 of 3
A tone above Nyquist

Drag f up to 12000 Hz, keeping f_s = 16000 Hz. Now f > f_s/2. Predict the frequency the tone appears at after sampling, then read it.

Expected

The sampled spectrum shows the tone at f_alias = 4000 Hz — it has folded down below Nyquist. A 12 kHz tone now masquerades as a 4 kHz one, its phase inverted.

4 / 7
DSP 101
M2 · Lab
Step 3 of 3
The filter that saves it

Leave f at 12000 Hz and turn on Filter before sampling. The filter must remove everything above the Nyquist frequency before the sampler sees it. Predict that ceiling f_s/2, then read the readout.

Expected

The Nyquist-frequency readout is f_s/2 = 8000 Hz. With the anti-alias filter cutting above it, the 12 kHz tone is attenuated before sampling, so the false 4 kHz alias disappears from the spectrum.

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

Everything above is waiting in the sandbox. Sweep f past f_s/2 and watch the tone fold, change the sampling rate, and toggle the anti-alias filter to see the fold appear and vanish in real time.

6 / 7
DSP 101
M2 · Lab
Wrap-up
What you did
  • Read a tone staying put at f_alias = 1500 Hz, below Nyquist
  • Watched a 12 kHz tone fold down to f_alias = 4000 Hz
  • Found the ceiling the anti-alias filter must enforce, f_s/2 = 8000 Hz
  • Every frequency you predicted is the demo's own fold arithmetic, not a picture
7 / 7
1 / 8 muted