DSP 101
M1 · Lab
Hands-on lab
Digitise a tone, then rebuild it

Take an analog tone through the whole round trip in the sandbox — analog in, samples, analog out — and predict, before the screen tells you, the slowest rate that still captures it, the headroom a CD-quality rate leaves on top, and how much a real converter droops the top of the band on the way back out.

Nyquist rate and oversampling
f_s \ge 2 f_{\max} \qquad \text{OSR} = \frac{f_s}{2\,f_{\max}}

Analog and digital audio differ on two independent axes: how often you look at the signal, and how finely you measure each look. This lab is the first axis — the sampling rate. Sample too slowly and you never capture the signal at all; sample with real headroom and a gentle converter can rebuild it — though never perfectly, as the DAC droop shows. (The second axis, bit depth, is the m1-l2 lesson's job; this sandbox does not measure it.)

1 / 7
DSP 101
M1 · Lab
Set it up
Analog in

Open the sandbox and Reset. Each step names the one knob to change and leaves everything else alone — in particular the anti-alias filter stays OFF for the whole lab (turning it on is the M2 lab's job).

Set these values
Waveform -> Single tone fs -> 16000 Hz (default) Filter before sampling -> off (this lab never uses it) Reconstruction -> Ideal (sinc)

Watch three readouts: Nyquist rate needed and OSR under the sampling knobs, and the hold droop at f_s/2 line in reconstruction panel 5.

2 / 7
DSP 101
M1 · Lab
Step 1 of 3
How fast to capture it

Drag f1 up to 10000 Hz — a bright cymbal-like partial. Ignore the sampling rate for a moment: predict the slowest rate that could still capture this tone, the Nyquist rate 2 f_max, then read Nyquist rate needed.

Expected

The Nyquist rate needed readout is 2 × 10000 = 20000 samples/s. This is a RATE the sampler must exceed — not the same thing as the M2 ceiling f_s/2, which is a frequency.

3 / 7
DSP 101
M1 · Lab
Step 2 of 3
The headroom CD audio leaves

Keep f1 = 10000 Hz, and from Standard rates pick 44.1 kHz — CD audio. Real systems sample well above the bare minimum. Predict the oversampling ratio OSR = f_s / (2 f_max), then read OSR.

Expected

The OSR readout is 44100 / 20000 = 2.21× — CD sampling captures this tone with just over twice the minimum rate, room a gentle anti-alias and reconstruction filter can live in.

4 / 7
DSP 101
M1 · Lab
Step 3 of 3
Analog out — a real DAC

Leave f_s = 44100 Hz and switch Reconstruction to Zero-order hold — a real DAC. A hold-and-repeat converter is not the ideal sinc: it droops the high end. Predict the hold gain at f_s/2, |sinc(π/2)| = 2/π, then read the hold droop at f_s/2 line.

Expected

The hold-droop readout is 2/π ≈ 0.637, i.e. -3.92 dB at the Nyquist frequency — a real DAC quietly loses the top of the band, which is why converters add a compensating filter. The ideal sinc would not droop at all.

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

Everything above is waiting in the sandbox. Slide f_s down toward 2 f_max and watch the oversampling ratio fall to 1×, switch between the ideal sinc and the zero-order hold, and watch the reconstruction error rise and fall in real time.

6 / 7
DSP 101
M1 · Lab
Wrap-up
What you did
  • Found the slowest rate that captures a 10 kHz tone, Nyquist rate = 20000 samples/s
  • Read the headroom CD audio leaves, OSR = 2.21×
  • Measured a real DAC's droop at Nyquist, 2/π ≈ -3.92 dB
  • Bit depth — the other analog-vs-digital axis — is not in this sandbox, so no SQNR was stated
7 / 7
1 / 8 muted