Three interactive explainers

Everything in a media file is numbers on a grid.

Digital audio and video have a reputation for being an elite specialty. They aren't. There's one genuinely deep idea — the sampling theorem — and then a long tail of engineering decisions, most of which are historical accidents that got frozen into standards. Start with the theorem, then walk the rest of the stack.

Every code sample comes in both Go and JavaScript, behind a toggle — copy, paste, and run either one.

01 — start here

Waves, for programmers

Amplitude, frequency, phase, superposition, spectrum and wavelength, each defined and demonstrated. Ends with the spectrogram window tradeoff.

phase spectrum spectrogram
Read →
02 — the one deep idea

Sampling, for programmers

The Nyquist–Shannon theorem, made interactive. Why a finite list of numbers can hold a continuous wave exactly, what aliasing actually is, and why the stair-step picture you've seen is wrong.

aliasing reconstruction sinc
Coming soon
03 — the long tail

A digital media primer for geeks

Bit depth and dynamic range, why adding noise on purpose makes audio better, µ-law companding, then the whole video half: interlacing, gamma, Y′CbCr, chroma subsampling and siting, pixel formats, containers.

PCM dither gamma Y′CbCr
Coming soon

Note

The pages, samples and write-up are ~90% generated with Claude AI. I review and curate these pages to my liking, but my edits are minimal. The content is based on Wikipedia and A Digital Media Primer for Geeks by Monty Montgomery.

The value added is interactive examples and some code samples. I use this for my own learning.