D51 of 13
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

D5 · Lesson 1 · Sampling and quantization

Turning a continuous signal into numbers by sampling it in time and rounding it in value, the Nyquist rate and the aliases that appear below it, the anti-aliasing filter, quantization step and noise, and the 6 dB per bit rule for an ADC's signal-to-noise ratio

Every digital audio recording, phone call and oscilloscope trace starts with two acts of approximation. Sampling keeps only the signal's values at regular instants, and quantization rounds each value to one of a fixed set of levels. Done right, sampling loses nothing at all: a signal with no frequencies above half the sampling rate can be rebuilt exactly. Done wrong, high frequencies masquerade as low ones, and no later processing can tell them apart. Quantization, meanwhile, always adds a little noise, and each extra bit cuts it in half.

  • A tone of frequency f sampled at fs: the stems are the samples, the solid curve the original tone, the dashed curve the lowest-frequency tone through the same samples, which is what a reconstruction would play.
  • Below fs/2 they agree. Above it the samples fit a lower alias just as well.
  • Listen to the alias: as you sweep f up past fs/2, the reconstructed tone comes back down.

Predict

A 5 kHz tone is sampled 8000 times per second with no filter in front. What frequency does the digital signal contain?

Name it

Sampling

Sampling at rate fs keeps x(nT) with T=1/fs. The sampling theorem: a signal with no content at or above fs/2, the Nyquist frequency, is determined exactly by its samples. A tone at f produces the same samples as tones at |f−kfs| for every integer k, so content above fs/2 appears at

fa=|f−fsround(f/fs)|

CD audio samples at 44.1 kHz to cover hearing up to 20 kHz with room for the anti-aliasing filter to roll off.

Quantization

A B-bit converter with full-scale range FS has 2B levels with step

Δ=FS2B

and rounding adds an error spread evenly over ±Δ/2, a noise of RMS value Δ/12. For a full-scale sine wave,

SQNR=6.02B+1.76 dB

so each extra bit buys 6 dB: 16 bits gives 98 dB.

Worked example

A 12-bit ADC spans 0 to 3.3 V. What's its step, its quantization noise and its best SNR?

Show the solution
  1. Step size. Twelve bits give 212=4096 steps across the range: Δ=3.3V4096=0.806mV
  2. Quantization noise. σq=0.806mV12=0.233mV RMS
  3. Best SNR. SQNR=6.02×12+1.76=74dB

Answer a step of 0.806 mV, 0.233 mV RMS of quantization noise, and a best SQNR of 74 dB.

Worked example

A system samples at 8 kHz. Where do tones at 7.5 kHz and 9 kHz land? How many bits give an 80 dB SQNR?

Show the solution
  1. The 7.5 kHz tone. It folds back around the 8 kHz sampling rate: |7.5−8|=0.5kHz
  2. The 9 kHz tone. |9−8|=1kHz
  3. Bits for 80 dB. Solve 6.02B+1.76=80 for B: B=80−1.766.02=13.0bits so a 13-bit converter, in practice a 16-bit one.

Answer 7.5 kHz aliases to 0.5 kHz and 9 kHz to 1 kHz, and 80 dB takes a 13-bit converter, in practice a 16-bit one.

Worked example

What are the best SQNRs of 16-bit and 24-bit audio converters, and which limit is likely to matter?

Show the solution
  1. 16-bit converter. SQNR=6.02×16+1.76=98.1dB
  2. 24-bit converter. SQNR=6.02×24+1.76=146.2dB
  3. The limit that matters. No analog circuit is quiet enough to use 146 dB: real 24-bit converters reach about 120 dB, limited by their analog noise rather than by quantization.

Answer 98.1 dB for 16 bits and 146.2 dB for 24 bits, but a real 24-bit converter stops near 120 dB, set by its analog noise.

Check

A 9 kHz tone is sampled at 8 kHz without filtering. At what frequency does it appear?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

What's the best signal-to-quantization-noise ratio a 12-bit converter can reach with a full-scale sine?

Check

An 8-bit ADC spans 3.3 V. How big is one step?

Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.

Check

What's the RMS quantization noise of that 8-bit, 3.3 V converter?

Write units the way you normally would: 1.5 µV, 1500 nV and 0.0015 mV are the same answer.

Check

A 12-bit ADC spans 0 to 1 V.

(a)

What is its step?

Write units the way you normally would: 1.5 mV, 1500 µV and 0.0015 V are the same answer.

(b)

What is its best SQNR for a full-scale sine?

Check

A 5 kHz tone is sampled at 44.1 kHz.

(a)

At what frequency does it appear?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

Is it below the Nyquist frequency (1 for yes)?

Explain why

Why must the anti-aliasing filter come before the ADC and not after it?

Practice

Keep practicing

8 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.