The Limitation of Linear Quantization
Before discussing companding, it is useful to identify the problem that this process addresses. In a standard PCM system, is used. This works well for signals with a uniform distribution, but it is inefficient for signals with a large , like human speech.
A conversation can include both a whisper and a shout. Linear quantization uses the same step for both levels. For the shout, the error is small relative to the amplitude and is usually barely noticeable. For the whisper, the same error can be close to the signal itself, reducing quality and making noise more audible. Hearing is more sensitive to interference in quiet passages. The constant error level worsens the Signal-to-Quantization-Noise Ratio (SQNR) for low-amplitude signals.
Companding
Companding is a term combining two stages: compressing the signal at the transmitter and expanding it at the receiver. It is a nonlinear transformation designed to improve the SQNR of signals with a large dynamic range, such as voice.
The companding process
The signal's dynamic range is shaped before quantization. At the transmitter, a compressor amplifies quiet, low-amplitude signals more than loud signals. This reduces the amplitude span and moves weak signal portions farther from the quantization-error level. The compressed signal is then quantized linearly. At the receiver, an expander performs the reverse operation: it attenuates quiet portions more than loud portions and restores the original dynamic range.
The Compression Curve
The nonlinear behavior of a compressor is described by its transfer function, called the compression curve. The graph plots output amplitude against input amplitude.
For an input signal and an output signal , a linear system would have . A compression curve has a logarithmic shape. Near zero, its slope is larger, indicating stronger amplification. As the input amplitude increases, the slope decreases and the gain becomes smaller. Quiet sounds are moved farther from the quantization-error level, while loud levels receive less gain.
A-law and µ-law companding laws
ITU-T Recommendation G.711 defines two companding laws for digital telephony: A-law and µ-law.
- A-law: Used primarily in Europe and in many other networks. When networks in different countries use different laws, G.711 specifies A-law for the international connection. Near zero, A-law has a linear section. Its compression parameter is .
The following formula gives the output magnitude for a normalized input magnitude : - µ-law (mu-law): Used primarily in North America and Japan. It has a slightly larger dynamic range than A-law. Its compression parameter is .
The following formula gives the output magnitude for a normalized input magnitude :
Digital implementation: piecewise-linear approximation
Implementing a smooth logarithmic curve in digital hardware is complex. In practice, the A-law and µ-law curves are approximated by a series of straight-line segments. An implementation may map a 12-bit linear PCM signal into a special 8-bit companded format. In G.711, A-law is also described as mapping 13-bit uniform PCM to an 8-bit word, while µ-law uses 14-bit uniform PCM.
The signal range is divided into segments, for example 8 positive and 8 negative segments for A-law. Segments near zero are narrower, so their quantization steps are smaller and represent quiet sounds more precisely. As the amplitude increases, the segments become wider and use larger steps because the error is less noticeable for louder sounds.
8-bit Companded Word Format
In a simplified description of the fields, the resulting 8-bit word encodes this information in three fields:
- 1 bit: Sign bit (positive or negative).
- 3 bits: Segment identifier (which of the 8 segments the sample falls into).
- 4 bits: The specific quantization level (one of 16) within that segment.
The Result: More Efficient Coding
For speech, an 8-bit PCM system with companding can achieve a dynamic range and SQNR comparable to 12-bit or 13-bit linear PCM, depending on the implementation. G.711 uses 8 bits per sample, which at 8000 samples per second produces a 64 kbps voice channel.
8000 samples/second × 8 bits/sample = 64,000 bits/second (64 kbps)
The 64 kbps rate is used in digital telephony, including ISDN voice channels.