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:
- 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.
- Quantize: round each measurement to the nearest of levels, where is the bit depth.
- Encode: store each level as an -bit binary word.
For example, with a 3-bit depth there are levels. A run of samples might be stored as . 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.