Analog-To-Digital Conversion: Quantization
Analog-To-Digital Conversion: Quantization
This lab focuses on uniform quantization. Without loss of generality, we suppose that the given
signal takes values in [−1, 1]. The interval [−1, 1] is split into N = 2p intervals of same size,
say ∆, forming a grid of N points at the center. Then, quantization amounts to rounding the
true value x to its closest value among the interval centers, noted xq .
Figure 1 shows the value of xq as a function of x.
1
0.75
0.5
0.25
0
-0.25
-0.5
-0.75
-1
-1 0 1
Such quantization introduces modifications (rounding errors) on the signal. On the other
hand, removing 1 bit (p → p − 1) decreases the space required in memory / for storage by a
factor of two. In this lab, we study the impact of quantization on the quality of audio signals.
Lab: study of quantization on audio signals
Tip: write all your Matlab instructions in a unique file (example quantization.m).
1. Download the audio file 'LedZeppelin.wav' available on the web server. From Matlab,
read associated information (audioinfo('LedZeppelin.wav')).
What value of p was used for generating this file?
We will now generate quantized signals at a lower number of bits and listen to the results.
Repeat the following steps, for varying values of p (between 16 and 1, use for loop).
6. Build the signal xq obtained after quantization with p bits (see Question 3 in first page).
7. Plot the quantized signal xq as a function of time on the same graph as the initial one (use
appropriate colors, and give a title containing the value of p). Can you see any difference?
Zoom in to see details.
9. Measure the error between the two signals by the signal-to-noise ratio:
kxk2
SNRdB = 10 log10 ,
kx − xqk2
11. Draw the graph that represents the signal-to-noise ratio as a function of p. What can you
conclude?
12. Compute and draw the linear regression of such curve (polynomial regression of order 1).
This result has a proof with probabilities. We will discuss it later.
13. Optional, but funny. Record a speech signal with your computer, and repeat the experi-
ment with it. Until which value of p can you understand the speech?
14. Optional, but funny, too. Repeat the experiments with any image of your choice (replacing
soundsc by imagesc!). Example: A=double(imread('cameraman.tif'));.
Be aware, pixel values in black and white or RGB images are usually encoded as integers
(with 8 bits) between 0 and 255. Center and normalize the image first: A = (A-128)/128;