Pulse-Code Modulation (PCM) is a method of representing a continuously varying analog signal as a sequence of discrete digital samples, each encoded as a fixed-width binary integer. It is the foundational digital audio and voice representation scheme used in virtually all digital audio and voice processing systems.
In practice
PCM shows up in embedded systems wherever analog signals must be captured, stored, transmitted, or played back digitally. A microcontroller's ADC performing periodic samples of an audio or sensor signal and storing the results as 8-bit or 16-bit uniformly quantized integers is producing raw PCM data. Common sampling rates in voice applications are 8 kHz (telephony, G.711) and 16 kHz (wideband voice); audio applications typically use 44.1 kHz or 48 kHz at 16 or 24 bits per sample.
In practice, PCM audio is streamed over I2S or TDM buses between MCUs, codecs (such as the TLV320 family or WM8960), and DSPs. Many SoCs with audio peripherals, including STM32 parts with SAI or I2S peripherals and i.MX RT series devices, directly produce or consume I2S-framed PCM. Getting the bit clock, frame sync polarity, and sample alignment right is a common source of bring-up bugs.
A key pitfall is confusing raw (linear) PCM with compressed or non-linear variants. G.711 transmits 8-bit samples but applies mu-law or A-law companding, which is a logarithmic encoding of amplitude rather than linear PCM. Treating companded samples as linear values or vice versa produces severely distorted audio. Always verify which format a codec or telephony peripheral is actually producing.
Memory and bandwidth budgets matter. Uncompressed 16-bit stereo PCM at 44.1 kHz consumes approximately 176.4 kB/s (about 172.3 KiB/s). On memory-constrained MCUs this often motivates the use of compressed formats (ADPCM, Opus, AAC), but PCM remains the interchange format at the codec boundary -- compression and decompression both ultimately produce or consume PCM samples.
Discussed on DSPRelated
Frequently asked
What are the three main parameters that define a PCM stream?
Sample rate (how many samples per second, e.g. 8 kHz or 48 kHz), bit depth (how many bits represent each sample, e.g. 8, 16, or 24 bits), and channel count (mono, stereo, or more). Together these fully determine data rate and dynamic range of the uncompressed stream.
What is the difference between linear PCM and companded PCM (mu-law / A-law)?
Linear PCM maps sample amplitude uniformly across the integer range, giving equal quantization step size throughout. Mu-law (used in North America and Japan) and A-law (used in Europe) apply a logarithmic compression before encoding, allocating more quantization levels to low-amplitude signals and fewer to high-amplitude ones. G.711 telephony uses 8-bit companded PCM. Treating companded data as linear or vice versa produces badly distorted output.
How does PCM data typically move between an MCU and an audio codec in embedded hardware?
Most commonly over I2S (Inter-IC Sound) or TDM (Time-Division Multiplexed) serial buses, with a separate I2C or SPI control interface for codec configuration. The MCU or a DMA controller feeds sample frames clocked by the bit clock and framed by the word-select (LRCLK) signal. Some lower-cost designs use PDM (Pulse-Density Modulation) from a digital microphone and convert to PCM in firmware.
What bit depth is enough for a given application?
Dynamic range scales at roughly 6 dB per bit, so 8-bit linear PCM yields about 48 dB, 16-bit about 96 dB, and 24-bit about 144 dB. Voice telephony (G.711) works with 8-bit companded PCM. Consumer audio typically uses 16-bit; professional audio and high-resolution recording use 24-bit.
ADC noise floors often limit practical dynamic range well below the theoretical maximum, so matching bit depth to ADC ENOB (effective number of bits) avoids wasting storage.
Is PCM the same as WAV?
No. WAV is a file container format defined by Microsoft and IBM. WAV files most commonly contain linear PCM audio, but the format supports many other codecs (ADPCM, IEEE float, GSM, etc.) identified by a format tag in the file header. When someone says a WAV file contains 'PCM audio' they typically mean uncompressed linear PCM, but you should always check the format chunk to confirm.
Differentiators vs similar concepts
PCM is often contrasted with PDM (Pulse-Density Modulation), which encodes amplitude as the density of single-bit pulses and is the native output of many MEMS microphones (e.g. MP34DT01, SPH0645). PDM requires
decimation filtering to produce PCM before further DSP. PCM is also distinct from PWM (Pulse-Width Modulation): PWM encodes a value as a variable duty cycle on a fixed-frequency carrier and is used for motor control and simple
DAC approximation, not for general audio sample streams. Within PCM itself, the distinction between linear PCM and companded PCM (mu-law, A-law) matters in telephony contexts -- see the G.711 note above.