Tech●●●●●Difficulty 3 of 5

How does a computer turn a sound wave into a list of numbers?

A song on your phone is only a long list of numbers, and the spoked wheels in films that seem to spin backwards show how that can go wrong.

▶ Start the story

A computer stores a sound as a long list of numbers. In digital audio the sound wave is encoded as numerical samples in a continuous sequence: the system measures the height of the wave again and again, very fast, and writes each measurement down. The method is called pulse-code modulation, or PCM. In a PCM stream the amplitude of the signal is sampled at uniform intervals, and each sample is to the nearest value within a range of digital steps. To play the sound, a digital-to-analog converter turns the numbers back into a smooth electrical signal that goes through an amplifier to a loudspeaker.

Sound to numbers and back
  1. Step 1: Analog signal

    A microphone gives a smooth electrical wave

  2. Step 2: Sample

    Measure its height at uniform intervals

  3. Step 3: Quantize

    Round each measurement to the nearest step

  4. Step 4: Store or send the numbers

    Copies stay identical

  5. Step 5: Convert back

    A DAC rebuilds the wave for the speaker

Two settings decide how faithful the copy is. The sampling rate is how many times per second the wave is measured. The is how many possible values each measurement can take: adding one bit doubles that number. CD audio takes 44,100 samples per second, each with 16-bit resolution, which gives a of about 96 dB.

How fast is fast enough? The Nyquist-Shannon theorem says that, to reconstruct a signal without aliasing, the sampling rate must be at least twice its bandwidth. People are commonly said to hear from 20 to 20,000 hertz, so the rate has to be above 40,000 samples a second. If it is too slow, aliasing creeps in: low frequencies appear that were never in the original. You have seen it in films, where a spoked wheel seems to turn slowly or backwards because the frame rate is too limited. To avoid it, the signal passes through an first.

The payoff is that digital audio allows an infinite number of copies without any degradation, unlike analog copies, which lose quality each time.

Quiz me

0/3

  1. 1.How fast must a digital recorder sample to capture sounds up to a given frequency?
  2. 2.What does the bit depth of digital audio set?
  3. 3.Why can a spoked wheel look as if it turns backwards in a film?

Recap

Sample at more than twice the highest frequency, and use enough bits for each sample.

💡 A trick to remember it · Twice the top note, or the wheel spins back: sample more than double what you want to hear.

Surprising fact · CD audio takes 44,100 measurements a second, each 16 bits.

Sources (6)

No source, no claim. Every fact in this lesson (16 claims) cites at least one of these.

  1. [1]Digital audio · Wikipedia
  2. [2]Pulse-code modulation · Wikipedia
  3. [3]Audio bit depth · Wikipedia
  4. [4]Nyquist–Shannon sampling theorem · Wikipedia
  5. [5]Hearing range · Wikipedia
  6. [6]Aliasing · Wikipedia
More lessons in 💻 Tech (3) See all tech lessons →

One more light on your map.

Get one lesson like this every day, about the things you love. Free, in two or five minutes.

Get the share card for this lesson ↗