Skip to content

Sampling is taking photos of air

Digital audio is not a staircase. The sample rate sets the highest frequency a file can hold, and the converter plays one smooth wave through the samples.

Updated · 7 min read Lesson 1 of 14 in Audio Science

In short

  1. A sample rate sets the highest frequency a file can hold, half the rate. It does not make the audible range smoother.
  2. The converter plays one smooth wave through the samples. The staircase is only a drawing, and its steps are filtered away.
  3. Use 48 kHz by default, 96 kHz for sounds you will slow down a long way, and check masters with a true-peak meter.
In this lesson (8)

The staircase in the textbook

Many audio textbooks show the same drawing: a smooth analog wave next to a blocky digital copy that looks like a staircase. It suggests that digital audio is jagged and that something is missing between the samples, so the obvious fix seems to be more samples per second.

The drawing is wrong about what you hear. A converter measures air pressure at regular instants, like a camera taking photos of moving air. On playback it does not hold each value as a flat step. It draws a smooth curve through the points, and if the photos were taken fast enough for the frequencies in the sound, that curve is the original wave.

Why it matters

Choosing a sample rate for the wrong reason

If you believe in the staircase, 192 kHz looks like a smoother picture. It is not. The sets how high a frequency the file can hold, nothing more. Every common rate already covers the full range of hearing, and each doubling of the rate doubles the disk space and the work every plugin has to do.

Figure 1. The Nyquist frequency is half the sample rate. Every common rate already stores everything up to the 20 kHz limit of hearing. Higher rates only add room above it.

Higher rates do have real uses, and they all involve content above 20 kHz. Record at 96 kHz with a microphone that reaches past 20 kHz and you capture ultrasonic detail. Slow that recording down by an octave and the detail between 20 and 40 kHz drops into the range you can hear. A 48 kHz recording has nothing above 24 kHz, so after the same octave drop its top end stops at 12 kHz and it sounds dull. A higher internal rate also gives distortion plugins room to create without , which is what does.

The science

The sampling theorem

The Nyquist-Shannon sampling theorem says a signal can be rebuilt exactly from its samples if it contains no frequency at or above half the sample rate (Shannon, 1949):

fs>2fmax⁡f_s > 2 f_{\max}

Here fsf_s is the sample rate and fmax⁡f_{\max} the highest frequency in the signal. Half the sample rate is the : 22.05 kHz at 44.1 kHz, 24 kHz at 48 kHz. Hearing tops out around 20 kHz, so 40 kHz would be the bare minimum. The margin above that is for the anti-aliasing filter. The converter must remove everything above the Nyquist frequency before it samples, and a filter needs a band in which to roll off. At 44.1 kHz that band is the narrow stretch from 20 to 22.05 kHz. Anything above the limit that gets past the filter does not vanish. It is stored as a false, lower frequency.

Listen

Hear a frequency fold back down

A tone sweeps up from 500 Hz to 15 kHz. At a 16 kHz sample rate everything above 8 kHz is stored as a falling ghost tone, the same fold a saturator causes when its harmonics pass the Nyquist limit.

Loading demo…
100%

Start with your speakers or headphones low.

On the way out, the converter turns the numbers back into a voltage. Its first stage may hold each value for a moment, which really is a staircase, but the steps themselves are energy above the Nyquist frequency. The reconstruction filter removes that energy, and what remains is the one smooth wave, with nothing above the Nyquist frequency, that passes through every sample. Its accuracy is set by the filters and the , not by anything missing between the samples.

Figure 2. The same 16 samples drawn two ways. The steps exist only in the drawing. Their sharp corners are energy above the Nyquist frequency, which the converter filters out, leaving the smooth wave through the dots.

The smooth curve also explains . The of the wave can fall between two samples and be higher than either of them. Take a sine at a quarter of the sample rate, sampled 45 degrees away from its peaks: every sample sits at 71% of the true peak. If those samples just touch 0 , the wave itself peaks at +3 dB. A sample-peak meter misses it. A true-peak meter, which oversamples to estimate the wave between samples, catches it.

Try it

See the samples, then slow them down

0 of 7 steps done

The jagged 12 kHz wave sounds like a pure tone and the analyzer shows one line, because the converter plays a sine whatever the display draws. After the octave drop the 48 kHz noise sounds dull, while the 96 kHz noise keeps its top end: it had content up to 48 kHz to move down.

Common mistake

Running every session at 192 kHz

Because a higher rate seems to raise quality across the board, you record and mix everything at 96 or 192 kHz. For ordinary recording it adds no audible detail below 20 kHz. It does cost you: the computer processes two or four times as many samples, files grow, and ultrasonic content can cause in playback gear that was not built to reproduce it. Converting a finished 48 kHz file up to 96 kHz does not help either, because upsampling cannot create content the original never captured.

The second mistake is trusting a sample-peak meter on the master. A master whose samples stop at 0 dBFS can still clip in a playback converter or a lossy encoder because of inter-sample peaks. Check the master with a true-peak meter and leave below 0 dBTP. A common target is -1 dBTP.

Takeaway

Pick the rate for the job

Use 48 kHz as your default. It covers hearing with margin, it is the standard for video, and it keeps CPU and disk use reasonable. Move to 96 kHz when you record sounds you plan to slow down or pitch down a long way, or when a session leans hard on distortion plugins that cannot oversample. Whatever the rate, finish with a true-peak check before you export.

3 questions

Check yourself

  1. A 48 kHz recording is pitched down an octave by playing it at half speed. Where does its top end now stop?
  2. Why do sample rates leave a margin between 20 kHz and the Nyquist frequency?
  3. Every sample of a master stops at 0 dBFS. How can it still clip on playback?

Sources

Show all 2

Next lesson · 2 of 14

Bit depth sets the noise floorMore bits do not make audio warmer or more detailed. Each one lowers the noise floor by about 6 dB, and dither turns rounding error on quiet sounds into steady hiss.
Portrait of Virzy Guns

Written by Virzy Guns

Songwriter and producer, founder of Virzy Guns Production. Now building HealingWave.