Skip to content
Tutorials Center
My learning

Topics

Lesson 18 of 46 · Sampling and Digital Transmission

Quantization and PCM

Compute quantization step and noise, derive SQNR = 6.02n + 1.76 dB, calculate PCM bit rates and see how mu-law companding protects quiet signals.

After sampling, the amplitude of each sample is still an arbitrary real number. A digital system has only a finite number of bit patterns, so every sample must be rounded to one of a finite list of levels. This quantization is the one irreversible step of analog-to-digital conversion, and it creates a noise of its own. In this lesson you measure that noise, derive the famous "6 dB per bit" rule and see why telephones compand.

A sine wave and its three-bit staircase version with a card listing levels, step size, maximum error, noise power and SQNR
A quantizer replaces a smooth wave with a staircase; the difference is quantization noise.

What you will learn

  • The uniform quantizer: levels, step size and maximum error.
  • The quantization noise power Δ²/12 and the SQNR formula.
  • PCM bit rate and what each extra bit buys.
  • Why non-uniform quantization (companding) suits speech.

Key terms

  • Quantization step Δ: the distance between adjacent levels.
  • Quantization error e = xq − x: bounded by ±Δ/2 in an unsaturated quantizer.
  • SQNR: signal-to-quantization-noise ratio.
  • Dynamic range: ratio of the largest to the smallest signal handled well.
  • Companding: compressing before and expanding after, so small signals get finer steps.

The uniform quantizer

A signal limited to ±Vmax is divided into L = 2ⁿ equal intervals, where n is the number of bits per sample. The step is

Δ = 2 Vmax / L = 2 Vmax / 2ⁿ.

Each sample is replaced by the center of its interval. The error never exceeds Δ/2. Example: Vmax = 1 V and n = 3 give L = 8 and Δ = 0.25 V, so the error is at most 0.125 V (this is exactly what the staircase picture shows).

Noise power

If the signal wiggles over many steps, the error e is roughly uniformly distributed between −Δ/2 and +Δ/2. Its power (mean square) is

Pq = Δ² / 12.

A full-scale sine wave of amplitude Vmax has power Vmax²/2. Therefore

SQNR = (Vmax²/2) / (Δ²/12) = (Vmax²/2) · 12 · L² / (4 Vmax²) = 1.5 · L²

and in decibels, with L = 2ⁿ:

SQNR(dB) = 10 log10(1.5) + 20 n log10(2) ≈ 6.02 n + 1.76 dB.

Every added bit gives 6.02 dB, the voltage ratio of 2. So 8 bits give about 49.9 dB, and the 16 bits of an audio CD give about 98.1 dB. The formula is for a full-scale sine wave. A signal that is 20 dB below full scale has an SQNR 20 dB lower, because the noise is fixed by Δ and the signal is smaller.

PCM and bit rate

Combining sampling at fs and n bits per sample gives pulse code modulation (PCM) at the bit rate

Rb = n · fs.

Telephone PCM: 8 kHz × 8 bits = 64 kb/s. Audio CD: 44.1 kHz × 16 bits × 2 channels ≈ 1.411 Mb/s. Notice the trade: a bit more fidelity costs bandwidth, because a data stream of Rb bits per second needs at least Rb/2 hertz of channel bandwidth (Nyquist's limit for binary signaling) and in practice more.

Companding

Speech is mostly quiet with occasional loud peaks. A uniform quantizer gives the same absolute error to loud and quiet passages, so quiet speech suffers a poor SQNR. The remedy is a compressor before the quantizer, which stretches small amplitudes, and an expander after it that undoes the stretch. The compressor-expander pair is a compander. North American and Japanese telephony use μ-law with μ = 255:

F(x) = sgn(x) · ln(1 + μ |x|) / ln(1 + μ), for |x| ≤ 1.

European systems use A-law with A = 87.6. Both give an 8-bit code a roughly constant SQNR over a wide range of input levels, at the cost of a lower SQNR at full scale than a 13- or 14-bit uniform code would give.

Common misconceptions

"Quantization error is random noise from the channel." It is deterministic: the same input always gives the same error. It behaves like noise only because it looks random.

"6 dB per bit works for any signal." The formula assumes a full-scale sine. A quieter signal loses decibel for decibel.

"More bits always sound better." Beyond the noise of the analog electronics and of the room, extra bits add nothing audible.

Try it

The first example measures the SQNR of a full-scale sine for several word lengths and compares it with 6.02n + 1.76.

Python Measure SQNR against the formula

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The second example compares an 8-bit uniform quantizer with an 8-bit μ-law compander for sine waves of different levels. The uniform quantizer's SQNR falls dB for dB with the signal level; the compander keeps it much flatter.

Python Companding keeps quiet signals clean

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check · 5 questions

of 5 answered You scored / 5 · perfect!

  1. 1. A quantizer has 10 bits and Vmax = 5 V. The step size Δ is about

    Δ = 2 Vmax / 2ⁿ = 10 V / 1024 ≈ 9.77 mV.
  2. 2. The quantization noise power of a uniform quantizer with step Δ is

    The error is uniform in ±Δ/2, giving mean-square Δ²/12.
  3. 3. What is the SQNR of an ideal 12-bit quantizer with a full-scale sine?

    6.02 × 12 + 1.76 ≈ 74.0 dB.
  4. 4. A signal 20 dB below full scale is quantized. Its SQNR is

    The noise stays the same while the signal power drops by 20 dB.
  5. 5. Digitizing 8 kHz speech with 8 bits per sample gives

    Rb = n × fs = 8 × 8000 = 64 kb/s.

Summary

  • Δ = 2Vmax/2ⁿ, error within ±Δ/2, noise power Δ²/12.
  • SQNR ≈ 6.02 n + 1.76 dB for a full-scale sine; quieter signals lose dB for dB.
  • PCM bit rate Rb = n · fs.
  • Companding (μ-law, A-law) keeps SQNR usable over a wide dynamic range.

Next: Line codes and pulse shaping