Clap your hands. The air around them squashes and stretches, and that ripple of pressure races outwards until it wobbles your eardrum — that is sound. Draw the pressure over time and you get a smooth, endlessly wiggling wave: a continuous curve with no gaps and no steps, gliding through every value in between.
A computer has a problem, though. It can only store numbers — a finite list of them — and this wave has infinitely many points. So how do we squeeze a smooth, never-ending curve into a box that only holds numbers? The answer is one of the neatest tricks in computing: sampling.
Instead of storing the whole curve, we measure its height at regular moments — thousands of times a second — and write down just those numbers. Each measurement is a sample. Play the samples back quickly and your ear stitches them together into something that sounds like the original.
The picture below shows a sound wave (the smooth curve) with the samples marked as dots. The computer keeps only the dots — the heights — and throws the curve itself away.
Two choices decide how faithfully those dots capture the wave: how often we measure, and how precisely we record each height.
The sample rate is the number of samples taken each second,
measured in hertz (Hz). A rate of
The bit depth is how many
More levels means each dot can sit closer to the true height of the wave, instead of being rounded to the nearest available rung.
Every second we take (sample rate) samples, and each sample costs (bit depth) bits. Stereo sound has two channels (left and right), so everything doubles. Multiply it all together:
Divide by
Notice how quickly it grows: a single three-minute stereo song at CD quality is over
Look back at the formula: every factor multiplies the size. Doubling the sample rate doubles the file. Doubling the bit depth doubles it too. Higher settings sound better but cost more storage and bandwidth — so engineers pick the lowest settings that still sound good enough for the job. A phone call uses a low rate (voices don't need much detail); a music studio uses a very high one.
It is tempting to think "more is always better — turn everything up!" But sample rate and bit depth are a trade-off, not a free upgrade. A higher sample rate and a higher bit depth do give better, more accurate sound — but they also make the file bigger, every single time. There is no setting that is both more accurate and smaller.
And remember: no matter how high you go, sampling only ever approximates the smooth wave. The stored dots are joined by straight-ish steps, never the true curve. More samples (and more levels) get you closer to the original — but you never quite reach the perfect, continuous wave you started with.
There's a beautiful rule here, discovered by Harry Nyquist and Claude Shannon: to capture a sound
faithfully you must sample at least twice as fast as the highest note in it.
Human ears top out around