How sound is sampled

Compare the smooth wave with the sample rectangles. Change the sampling frequency and bit depth, then play what the computer stored.

Theory Beginner+ Analogue · Digital · PCM ~10 min
The idea

Measure the wave, then store numbers

A real sound wave is continuous. A computer stores a list of numbers instead. Two settings control quality:

  1. Sampling frequency — how many times per second we measure the wave (more samples → closer shape).
  2. Resolution (bits) — how many height steps each sample can use (more bits → smoother loudness).
TipThe rectangles are a sample-and-hold view: each sample keeps its height until the next sample.
ExampleThis demo tone
tone.txtSignal
wave       sine, 440 Hz (note A)
window     8 ms of the wave
samples    set by the frequency slider
levels     2^bits height steps

Try a low sample rate or 2-bit resolution — the rectangles pull away from the smooth curve.

Interactive

Sample the wave

Move the sliders. Watch the rectangles. Press play to hear the difference.

Step 0 / 0
Wave · samples · levelslab
Ready
Use the sliders, or press Step to walk through the lab.
Shortcuts: Space play/pause · → step · ← back · R reset
Remember

Three ideas

What sampling always does.

Time

Sampling frequency

Measures the wave many times per second. Too few samples and the rectangles miss the curve.

Height

Bit resolution

Rounds each measure to the nearest allowed height. Fewer bits make big, blocky steps.

Sound

Play what was stored

The computer only has the sample list. Playing it rebuilds a stepped wave from those numbers.