Lab: Compare Analog and Digital Audio
Digitise a tone, then rebuild it
What you will do
- How fast to capture it
- The headroom CD audio leaves
- Analog out — a real DAC
Interactive pages for this course. Every number on them is computed in your browser — nothing is a recorded animation, and nothing calls out to a server.
Digitise a tone, then rebuild it
Sample a tone, watch it fold
Convolve, one lag at a time
Place a pole, watch the response move
See a tone land in a bin
Read what a window costs and buys
Design an FIR, read its linear phase
Compare an FIR to an IIR
Read the time-frequency trade-off
Pull a signal out of the noise
Change the sample rate, keep the sound
Design one chain, stage by stage
Raise a tone past half the sampling rate and watch — and hear — the pitch come back down. The replica spectrum, the folding map, a real Butterworth anti-alias filter and the wagon-wheel view of the same arithmetic.
Build your own x and h by dragging the stems, then walk the lag while h flips, shifts and multiplies. Every product is written out term by term, the algebraic properties are recomputed on your sequences, and a computed room response lets you hear what a convolution is for.
Drag poles and zeros on the z-plane and watch four views move together: magnitude, phase, impulse response and the pole-zero map itself.
Where spectral leakage comes from: change the tone, the window and the zero-padding, and watch the DFT bins respond.
The window figures of merit, computed from the coefficients: equivalent noise bandwidth N·Σw²/(Σw)², coherent gain (Σw)/N, scalloping loss and peak sidelobe level, each shown beside the published Harris (1978) value. Put a tone (plus noise) through a windowed FFT, detect the peak, and read its frequency and its coherent-gain-corrected amplitude 2|X_peak|/Σw. Watch the analyzer's central trade: a narrow window resolves close tones but hides weak ones; a wide one sees the weak tone but merges the close pair.
Design the same specification as FIR and as IIR at once, and see the trade-off the lessons describe in words — order, phase linearity and stopband.
The time-frequency resolution trade-off, made physical: change the window length and overlap and watch what the spectrogram can and cannot resolve.
Bury a known template in seeded Gaussian noise, run the matched filter (a cross-correlation with the template), and watch the peak stand out where the raw record shows nothing. The processing gain 10*log10(N), the output SNR, and the ROC -- P_d against P_fa -- are all computed, with an optional Monte-Carlo overlay that converges onto the analytic curve.
Convert a signal from one sample rate to another by a rational factor L/M -- upsample by L, lowpass, downsample by M. The reduced L/M (48000 → 44100 = 147/160), the new sample count N' = round(N·L/M), and the anti-alias cutoff min(f_s, f_s')/2 are all computed, and zero-order-hold, linear and windowed-sinc interpolation are ranked by their reconstruction error (sinc < linear < ZOH). Downsample a high tone with the anti-alias filter off and watch it fold.