Multimedia & Machine Learning Algorithms · Multimedia Algorithms
Sampling & Quantization — Nyquist-Shannon Theorem and Quantization Error
Explanation
Sampling & Quantization — Intuition
Music recorded in a studio is a continuous (analog) signal: air pressure varying tens of thousands of times per second. To store it on a computer we sample the signal—measure its value at fixed time points—and represent each measurement as an integer. Two fundamental questions arise:
1. How many times per second to sample? — the Sampling question
2. At what precision to represent each measurement? — the Quantization question
Sampling
Denote the sampling rate by (in Hz — samples per second).
Nyquist-Shannon Sampling Theorem: A continuous signal whose highest frequency component is can be perfectly reconstructed from its samples if (sufficient condition):
In practice, (the Nyquist rate) is a theoretical minimum — at this exact boundary, reconstruction may fail for some signals (e.g., a sinusoid sampled precisely at its zero crossings). Therefore is used with a safety margin.
The limit is called the Nyquist frequency. Sampling exactly at is called the Nyquist rate.
Example: CD audio — the human ear hears up to ~20,000 Hz. The standard sampling rate is Hz, safely above Hz.
Aliasing: When sampling too slowly (), high-frequency components "disguise" themselves as lower frequencies. A signal at frequency appears at:
Quantization
Each sample is represented as a -bit integer. Number of levels: . The spacing between adjacent levels — the step size — is:
The quantization error (difference between true and represented value) is bounded:
Signal-to-Quantization-Noise Ratio (SQNR): For a full-scale sinusoid it can be shown that:
Each additional bit adds ~6 dB — multiplying the power ratio by .
Interactive Visualization
Loading visualization
Worked Examples
Practice
Exercise 1 of 6
1
An audio signal with maximum frequency Hz. What is the minimum sampling rate (Nyquist rate) for perfect reconstruction?
★Quiz
Test your knowledge from this lesson
A mix of questions from the lesson — each attempt varies slightly
Answer at least 4 out of 5 questions correctly to pass (70%)