Beruflich Dokumente
Kultur Dokumente
OBJECTIVES:
To assist the students in developing a thorough understanding of the process of
uniform and non-uniform quantization. The students will be able to differentiate between uniform
and non-uniform quantization and develop codes to implement both processes.
INTRODUCTION:
This lab basically deals with the quantization process of the speech signal.
Quantization is a main function when an analog signal is digitalized and different levels are
adjusted for the better outcomes. The quantization process is that in which the amplitude of the
analog signal is defined in different levels so that the amplitude can be discretized. After
quantization process the signal does not have infinite amplitude values because the amplitude sets
according to different quantized levels. There are different types of quantization such as 1) uniform
quantization, 2) non-uniform quantization. In uniform quantization the levels set for quantization
have same distance (called as q), and all levels are uniform so if the analog signal have large
amplitude uniform quantization will be easy and give almost same waveform but if the analog
signal’s amplitude is small than there will be more chance of quantization error by using the
uniform quantization, so for this case non-uniform quantization is used. When the amplitude of
the analog signal is small and in-fact most of the signals have low amplitude, the non-uniform
quantization is quite useful and there will be less chance of error.in non-uniform quantization some
of the levels are set very closely for the small amplitude and some levels are set with higher
separation to tackle the large amplitude peaks and thus in this way the quantization error will be
less. For the non-uniform quantization two methods are used: 1) u-law method 2) A-law, and
both have formulas for quantization as follows :
u-law :
log( 1 + 𝜇|𝑚|)
|𝑣| =
log( 1 + 𝜇)
(1 + 𝜇)|𝑣| − 1
|𝑚| =
𝜇
A-Law :
𝐴|𝑚|
, 0 ≤ |𝑚| ≤ 1/𝐴
1+log 𝐴
|𝑣| = {1+log(𝐴|𝑚|) 1
, ≤ |𝑚| ≤ 1
1+𝑙𝑜𝑔𝐴 𝐴
|𝑣|(1 + 𝑙𝑜𝑔𝐴)
, 0 ≤ |𝑣| ≤ 1/(1 + 𝑙𝑜𝑔𝐴)
𝐴
|𝑚| =
10(|𝑣|(1+𝑙𝑜𝑔𝐴)−1) 1
, ≤ |𝑣| ≤ 1
{ 𝐴 1 + 𝑙𝑜𝑔𝐴
IN-LAB TASKS :
TASK 01 :
MATLAB CODE :
[y, Fs] = wavread('orig4.wav') %command used for read a wav(audio) file and
gives y as output
figure();
plot(y) %command used for plotting y values
xlabel('time')
ylabel('amplitude')
title('time domain')
This picture represent the original signal obtained from the audio file using the function wavread,
the signal have the sampling frequency of the signal is 44.1KHz and the amplitude have different
variations.
Above figure represent the down sampled signal of the original signal obtained from the audio
file,thus by down sampling by a factor of 10 compress the original signal 10 times on time axis.
This figure is a fourier transform representation of the signal obtained from the audio file.in
frequency domain all the values are very concentrated due to the fftshift because fftshift
converge all the values on 0.
This figure shows the fft transform of the down sampled signal. From this figure we can observed
the down sample effect in frequency domain, in frequency domain down sample suppress the
signal by a factor of 10.
TASK 2:
1. A .wav file is usually 16 bit quantized. Use a uniform quantizer to reduce the down
sampled version to it to 4-bit.
2. Find out the quantization noise. Plot it and find out mean square quantization error.
3. Use µ -LAW to reduce the 16-bit quantization to 4-bit. Plot quantization noise and find
mean square error for different values of µ.
4. Use A-LAW to reduce the 16-bit quantization to 4-bit. Plot quantization noise and find
mean square error for different values of A.
5. Repeat the tasks (1-4) but now use 8-bit quantization.
6. Present your results in tabular form, compare quantization noise plot of uniform and non-
uniform quantization.
MATLAB CODE:
clear all %to clear all previous simulations and graphs
close all
clc
figure();
plot(y) %command ysed to plot the signal
l = 4;
MATLAB FIGURE:
This picture represent the original signal obtained from the audio file using the function wavread,
the signal have the sampling frequency of the signal is 44.1KHz and the amplitude have different
variations.
Above figure shows the levels defined for the quantization and the distance between each level is
same so this is uniform quantization. Also the mean square error was calculated and which show
the gap between the analog signal and the quantized level, there will be less error for more
quantization levels.
DOWNSAMPLED SIGNAL:
MATLAB SIGNAL :
clear all %to clear all previous simualtions
close all
clc
[val index] = min(temp); %allocate the signal value with respect of the
minimum value.
end
%downsampled signal
y11 = downsample(y,10); %down sample the original signal by factor 10
figure();
plot(y11)
ms = mse-mse1
MATLAB FIGURE:
This picture represent the original signal obtained from the audio file using the function wavread,
the signal have the sampling frequency of the signal is 44.1KHz and the amplitude have different
variations.
This figure represent the mean square error obtained from the down sampled signal by factor 10.
The error also reduced 10 times in down sampled signal which is a quite useful information of
down sampled signal.
POST-LAB:
TASK:
MATLAB CODE:
subplot(3,2,4)
imshow(quantI,[])
title('Image with quantization level of 6 bits');
subplot(3,2,5)
imshow(quantI,[])
title('Image with quantization level of 4 bits');
This figure shows the different variation of quantization level on the picture, as the quantization
level decreased the picture gets more blured and thus determine that there will be more error in
2-bit quantization than 16-bit quantization levels.
CRITICAL ANALYSIS: