Pulse Code Modulation: Basic Principles of Converting Analog Signals to Digital Bits

    Pulse Code Modulation (PCM) is the fundamental technique for converting continuous analog signals into discrete digital sequences for storage, transmission, and processing. This article explores the basic principles of PCM, detailing its three essential steps: sampling, quantization, and encoding. It further examines the relationship between quantization bit depth and signal-to-noise ratio (SNR), discusses the implementation of non-uniform quantization and companding for voice signals, and analyzes the trade-offs involved in selecting parameters to determine the final bitrate.

    1. Why Pulse Code Modulation is Needed

    Real-world physical quantities such as sound, temperature, and pressure are continuous analog signals. Computers and digital networks can only process a finite number of discrete values, so continuous signals must first be converted into digital sequences before they can be stored, transmitted, and processed. Pulse Code Modulation (PCM) is the classic method for accomplishing this conversion.

    In 1948, Shannon published “A Mathematical Theory of Communication,” which established the theoretical framework for information quantization and channel capacity. It proved that information could be transmitted reliably over noisy channels using digital methods, providing the theoretical basis for digital communication. PCM serves as the concrete pathway for routing analog signals into digital channels.

    The concept of PCM traces back to around 1937, when the idea of representing analog amplitudes with coded pulses was first proposed. With the evolution of electronic devices and digital circuits, PCM gradually became the foundational technology for telephone networks, digital audio, and data acquisition systems.

    2. The Three Basic Steps of PCM

    The PCM processing flow consists of three sequential steps: sampling, quantization, and encoding. The output of each step serves as the input for the next.

    2.1 Sampling: Taking Points on the Time Axis

    Sampling is the process of reading the signal amplitude at fixed time intervals. The reciprocal of the time interval is called the sampling rate, fs, measured in Hertz (Hz).

    Sampling must satisfy the Nyquist-Shannon sampling theorem. If the highest frequency of the signal is fmax, the sampling rate fs must be at least 2 × fmax to reconstruct the original signal from the sampled values without distortion. When sampling falls below this threshold, high-frequency components fold into the low-frequency region, causing aliasing. This type of distortion cannot be eliminated in later stages.

    In engineering practice, an anti-aliasing low-pass filter is typically applied before sampling to limit the signal bandwidth to within half of the sampling rate. The effective frequency band for telephone voice is approximately 300Hz to 3400Hz, so an 8kHz sampling rate is commonly used, leaving a sufficient transition band for the filter.

    2.2 Quantization: Taking Levels on the Amplitude Axis

    The amplitudes obtained from sampling are still continuous real numbers. Quantization maps them to a finite number of discrete levels. When using n bits for encoding, 2^n levels can be obtained.

    Using uniform quantization as an example, if the input range is [-1, 1] and the endpoints are included as levels, the quantization step size is Δ = 2 / (2^n − 1). The difference between the quantized value and the original value is called the quantization error, which is approximately uniformly distributed within the range of ±Δ/2. Quantization error cannot be completely eliminated; it can only be reduced by increasing the number of bits.

    2.3 Encoding: Writing Levels into Bits

    The encoding stage converts the quantized level index into a binary code word. For example, a 3-bit system has 8 levels, where indices 0 to 7 correspond to code words 000 to 111. The receiving end reverse-maps the code words using the same rules to obtain the approximate amplitude.

    The encoding order is typically fixed. The code words of each sample are concatenated sequentially to form a time-ordered bitstream. The receiving end relies on frame synchronization or clock recovery to determine the start and stop positions of each code word.

    3. Relationship Between SNR and Bit Depth

    The magnitude of quantization noise directly determines the quality of the reconstructed signal. For a full-scale sine wave, the theoretical signal-to-noise ratio (SNR) of uniform quantization can be approximated as:

    SNR ≈ 6.02 × n + 1.76 dB

    Where n is the number of quantization bits. For every additional bit, the SNR increases by approximately 6dB. The theoretical SNR of an 8-bit system is about 49.9dB, while a 12-bit system is about 74.0dB.

    This formula assumes that the input signal is full-scale and the quantization noise is approximately uniformly distributed. In reality, the amplitude of voice signals mostly concentrates in a smaller range, and the SNR of small signals is often lower than the value given by the formula. This is the primary reason for introducing non-uniform quantization.

    4. Non-Uniform Quantization and Companding

    The energy distribution of voice signals is uneven, spending most of the time in the low-amplitude region. If all levels are equally spaced, small signals will suffer from a larger relative quantization error, resulting in noticeable background noise to the human ear.

    The approach of non-uniform quantization is to use smaller step sizes for low-amplitude regions and larger step sizes for high-amplitude regions. In practical systems, this is often implemented using companding. The transmitter first applies non-linear compression to the signal, and the receiver applies the corresponding expansion. Two types of companding curves widely used in telephony are known as μ-law and A-law. By applying companding, 8-bit encoding can achieve a subjective quality close to that of a much higher-bit uniform quantization.

    5. Bitrate and Parameter Trade-offs

    The bitrate of PCM is determined by three parameters:

    Bitrate = Sampling rate × Quantization bit depth × Number of channels

    A typical configuration for telephone voice is 8000Hz, 8-bit, and mono, resulting in a bitrate of 64kbps. High-fidelity audio uses higher sampling rates and more bits, causing the bitrate to multiply accordingly.

    Selecting parameters requires a comprehensive consideration of three factors:

    • The signal bandwidth determines the minimum sampling rate;
    • The target SNR determines the minimum number of bits;
    • The available channel capacity or storage space determines the maximum allowed bitrate.