Inside digital audio: samples, Nyquist, bit depth, and aliasing
Learning objectives
- learner can explain how continuous sound becomes samples, and predict the effects of sample rate (Nyquist/aliasing) and bit depth (dynamic range, quantization) on audio quality
- learner can diagnose and prevent common digital defects: aliasing, clipping, inter-sample peaks, and quantization noise
Capstone — one whole task that evidences the objectives
Take a bright synth patch, deliberately provoke aliasing and clipping, then fix both — set bit depth and dithering, apply headroom for inter-sample peaks — and document what each change did to the signal.
Prerequisite modules
Every live-coded set and every synth patch you will ever build lives inside a sampled, quantized, deadline-driven number stream. When a bright lead turns harsh and metallic at the top of the keyboard, or a stacked drop comes back from the club sounding crushed, the cause is almost never “bad taste” — it is Nyquist folding, clipped samples, or peaks the DAC reconstructs above full scale. This module builds the whole task of hearing, provoking, and curing those digital defects on a real patch, so they become diagnosable instead of mysterious.
The arc starts supported: sweep a plain sine and a naive sawtooth up the spectrum while watching an analyzer, using the sampling and Nyquist atoms plus “frequencies above Nyquist fold back as inharmonic aliases” as just-in-time pointers to name what you hear. Next, drop bit depth on a quiet pad and reach for “reducing bit depth adds harmonic quantization noise; dithering trades it for benign broadband noise” to fix it. Then push levels: sum oscillators past ±1, meet digital clipping, and discover that even legal samples can hide inter-sample peaks. The capstone removes the scaffolding — you provoke aliasing and clipping on your own bright patch, then repair both with band-limited oscillators, dither, and true-peak headroom, documenting each change.
Required atoms gate the capstone directly: without the sampling model, Nyquist, aliasing, quantization, dither, and clipping concepts, the fixes are cargo-cult moves. Supporting atoms enrich the picture — why analog/digital and continuous/discrete are separate axes, when 12-bit crunch or a deliberate alias oscillator is an aesthetic choice rather than a defect, and a first glimpse of the real-time callback and latency budget that a later module treats in full.
Runnable examples
Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.
bitcrush
s("bd*4").crush(4)
strudel-0022 · CC0
d1 $ sound "bd*4" # crush 4
tidal-0021 · CC0
saturation-drive
d1 $ sound "bd*2" # shape 0.4
tidal-0033 · CC0
{ (SinOsc.ar(110) * 5).tanh * 0.2 }.play
supercollider-0009 · CC0
Atoms in this module
Required — these gate the capstone
Supporting — enrichment, not gating
Part of curricula
- Dawless Performer — hardware jam to recorded live take — Signals, voices, and the DAWless mindset recommended
- Electronic Music Producer — from raw sound to a released track — Make your first loop — sound, DAW, and the ear required
- Live Coder — zero to performing live-coded music — Patterns, Grooves & Voices recommended
- Synthesist / Sound Designer — deep DSP to a performed live synth rig — Hearing sound as spectrum, shaping a first voice required
Unlocks — modules that require this one
- Delay lines, comb filters, and modulation effects
- Classic drum machines and sample-based percussion
- Granular synthesis: grains, clouds, and time-frequency textures
- Oscillators: raw waveforms, phase, sync, and unison
- Spectral analysis and processing: FFT, STFT, and the phase vocoder
- Waveshaping and distortion: nonlinear timbre and saturation