Pulse code modulation

Pulse code modulation (PCM) is the standard way to represent an analog signal as digital data. WAV, AIFF, and CD audio all store PCM.12

PCM converts a signal in three steps:

  1. Sample: measure the signal's amplitude at a fixed rate (e.g. 44,100 times per second). The sampling theorem sets how fast this has to be.
  2. Quantize: round each measurement to the nearest of 2n2^n levels, where nn is the bit depth.
  3. Encode: store each level as an nn-bit binary word.

For example, with a 3-bit depth there are 23=82^3 = 8 levels. A run of samples might be stored as 010,000,111,101010, 000, 111, 101. That sequence of numbers is the digital audio.

The intermediate step, after sampling but before quantizing, is a train of pulses whose heights equal the sampled values. That's pulse amplitude modulation (PAM). PCM goes one step further and turns those heights into codes, hence the name.