comp_3_ee562
TRANSCRIPT
-
8/3/2019 Comp_3_EE562
1/5
King Fahd University Of Petroleum & Minerals
Department of Electrical Engineering
EE562-Digital Signal Processing I
2010-2011 First Semester (101)
Comp. Assign. 3 Due Date: December 27, 2010
Ser Name ID# SEC#
-------------------------------------------------------------------------------------------------------------
Question1
Introduction:
Musical programs are produced in two stages. First, sound from each individual instrument is
recorded on a single track. Then, the signal from each track is manipulated by the sound engineer to add
some special audio effects. A number of such signals are combined in a mix down system to finally generate
the stereo recording. The audio effects are artificially generated using various signal processing circuits and
devices being performed using digital signal processing techniques. Commonly used time domain operations
carried on musical signals are echo generation, reverberation, flanging, chorus generation, and phasing. The
basic building block of these operations is a delay.
Single Echo System (Filter):
Echoes are generated by delay units using the FIR filter characterized by the difference equation:
( ) ( ) ( ), 1y n x n x n R
Or, equivalently, by the transfer function
( ) 1R
H z z
The delay parameter R denotes the time the sound wave takes to travel from the sound source to the listener
after bouncing back from the reflecting wall, whereas the parameter , with 1 , represents the signal
loss caused by propagation and reflection.
First:
(a)Determine and show if the system is: static or dynamic, linear or nonlinear, time invariant or timevariant, causal or non causal, and stable or non-stable.
(b)Is the system FIR or IIR system and why.(c)Find the impulse response of the above system, take 0.5 and 1R .Second:
The function echo1.m simulates the single echo system. Understand it very well. Write an m-file (Matlab
code) that uses the function echo1.m and generate an echo to the sound file Ali.wav. Your code has to do
the following:Read the sound file using the command wavread, passes the data file to the function echo1.m and listen to
the echoed sound using the command wavplay. Take 0.5 and try the following values of R: 10, 100,
1000, and 10000.
(d)Submit your code.
-
8/3/2019 Comp_3_EE562
2/5
Third:
Now ignore the function echo1.m and write another code that generates an echo to the sound file Ali.wav.
Your code has to do the following:
Read the sound file using the command wavread, generate the echo using the command filter and listen
to the echoed sound using the command wavplay. Take 0.5 and try the following values of R: 10, 100,
1000, and 10000.
(e)Submit your code along with one paragraph stating your observations.Save your echoed file with R=10000 in a *.wav format using the command wavwrite. Use your name
instead of the *.
(f) Send echoed sound file with R=10000 using Blackboard.(g)Find the impulse response values and then use the function fft in Matlab to find and then plot the
magnitude and phase responses of the single echo system.
Multiple Echo System (Filter):
To generate a fixed number of multiple echoes spacedR sampling periods apart with exponentially decaying
amplitudes, one can use an FIR filter with the following transfer function:
2 2 1 ( 1) 1( ) 11
N NR
R R N N RR
z H z z z zz
An infinite number of echoes spaced R sampling periods apart with exponentially decaying amplitudes, one
can use an IIR filter with the following transfer function:
2 2 1( ) 1 , 1
1
R R
R H z z z
z
Fourth:The coefficients of numerator and denominator of the multiple echo filter represents the filter coefficients of
the command filter and they can be easily determined in Matlab. Write a function in Matlab call it
echomany.m that simulates multiple echo system. It should accept 4 parameters as input to the function:
the input audio signal, the delay R, the attenuation, and the total number of echoes. Now write a Matlab code
that generate multi echoes to the sound file in a similar way like what you did before. Take 0.5 , R =
1000, and vary the number of echoes, N.
(h)Submit your code and the function.Save your echoed file with R=1000 and number of echoes equals 5 in a *.wav format using the command
wavwrite. Use your name instead of the *.
(i) Send echoed sound file using Blackboard.(j) Plot the magnitude and phase responses of the multiple echo system.
-
8/3/2019 Comp_3_EE562
3/5
Question2
System Inverse and Deconvolution, and System Identification:
Introduction
Two LTI causal discrete time systems with impulse responses1( )h n and
2( )h n are inverses of each
other if 1 2( ) ( ) ( )h n h n n or in the z-domain 1 2( ) ( ) 1H z H z . An application of the inverse systemdesign is in the recovery of a signal that has been transmitted through an imperfect transmission channel. It
is a common practice to consider a causal inverse of a causal system. The causal inverse of the parent causal
system with minimum-phase transfer function is always stable. A causal and stable system with all zeros
inside the unit circle is called a minimum phase system. As a result, we will look at causal minimum phase
system since its inverse is also causal and stable.
If the system is not of minimum phase, it can be made minimum phase by cascading it with an all
pass system. The all pass system has a unity magnitude response. All pass system has many applications
such as in linearizing the non linear phase response of systems and in making a non-minimum phase system
to be minimum. The general form of all pass filter is the following:1 1 1
1 11
1
0
0
( )( )1 ( )
where ( ) and 1
N N
NN NN
N
Nk
k
k
a a z a z z A z H z za z a z A z
A z a z a
This means that the poles and zeros in all pass system are reciprocal of one another. In other words,
the poles and zeros are mirror symmetric with respect to the unit circle.
Single Echo System:
We used I question1 the minimum phase causal and staple FIR single echo filter spaced R sampling periodsapart characterized by the difference equation:
( ) ( ) ( ), 1y n x n x n R
Or, equivalently, by the transfer function
( ) 1R
H z z
where the parameter , with 1 , represents the signal loss caused by propagation and reflection.
First:
The file 'Ali_echo1.wav' is the echoed file. If you know the system function of the system which is the
single echo system of 0.5 and 10000R . Use the function filter to pass the echoed file into its inverse
to obtain the original un-echoed file. Your Matlab code has to do the following:
Read the echoed sound using the command wavread; passes the data to the inverse function specified in
the command 'filter'; listen to the recovered pure sound file using the command wavplay ; and save your
pure file in a *.wav format using the command wavwrite. Use your name instead of the *.
(a)What is the inverse system function of the single echo system in the z-domain.(b)Plot the impulse response of the inverse system in the time domain. IfR=1, finding a closed form for the
impulse response of the inverse system is easy using common z-transform pairs table. However, since
R=10000 here, try to find and plot the impulse response of the inverse system using Matlab; use impz
and then stem.
(c)Submit your code along with a one paragraph comments.(d)
Send the pure sound file using Blackboard as an email.
-
8/3/2019 Comp_3_EE562
4/5
Multiple Echo System:
We also used the minimum phase causal and staple multiple echo FIR filter. To generate a fixed number of
N-1 multiple echoes spaced R sampling periods apart with exponentially decaying amplitudes, one can use
an FIR filter with the following transfer function:
2 2 1 ( 1) 1( ) 1
1
N NR R R N N R
R
z H z z z z
z
Second:The file 'Ali_echoN.wav' is the multiple echoed file. You know the system function of the system which is
the multiple echo system of 0.5 , 4N (three echoes), and 1000R . Repeat everything in First.
Deconvolution
If you don't have a closed form expression for the system function in the z-domain. You will not be able to
use the function filter to pass the echo file to the inverse system. In this case, you can recover the original
sound file using deconvolution in which you deconvolve the impulse response of the echo system from the
output echoed sound file to get back the original pure input file. Remember here you don't work with the
inverse system but with the actual impulse response of the system. The following formula can be used to do
the deconvolution:
1
0
(0)(0)(0)
( ) ( ) ( )
( ) ; 1(0)
n
k
yxh
y n x k h n k
x n nh
Where y(n) is the echo file (output), h(n) is the impulse response of the system, and x(n) is the wanted
original input signal.
Third:
Try to recover the original pure sound file from 'Ali_echoN.wav'. Here you will not recover using the
command filter but instead try to simulate the above recursive equation. You need the impulse response of
the system h(n); use the function impz for that. Be careful that Matlab start indexing from 1 not zero so you
need to modify the above equation slightly. Also make sure that h(n) and y(n) is of same size by padding
h(n) with zeros or generating the appropriate amount of samples when using impz.
(a)Plot the impulse response of the system in the time domain using Matlab; use impz and then stem.(b)Submit your code along with a one paragraph comments.(c)Send the pure sound file using Blackboard as an email.
-
8/3/2019 Comp_3_EE562
5/5
System Identification:
Previously, we recover the input pure sound file by using either the system function or impulse response of
the system. Here, assume you have the sound file 'Ali_echoU.wav' that you don't know its system function
nor its impulse response. So you need to identify the system first that generate such an echo sound. You
train the channel (your system) with a known sequence (input) and you observe the output. From the input
output values, you can determine the impulse response of the system using the following:
1
0
(0)(0)
(0)
( ) ( ) ( )
( ) ; 1(0)
n
k
yh
x
y n h k x n k
h n nx
Where y(n) is the output observed sequence, h(n) is the impulse response of the system, and x(n) is input
training sequence.
Fourth
Given the sound file 'Ali_echoU.wav' and the input output train sequences, Try to find the impulse response
of the system first from the two training sequences and using the above relation, then recover the original
pure sound file from 'Ali_echoU.wav' using the procedure in Third. Remember that the training sequencehas to be at least of the same length as the channel (size of the impulse response of the system). The input
output training sequence is saved in a file called 'training_sequence.mat'. You can load these data using the
command load. Then, make sure after finding the impulse response of the channel using the recursive
equation to pad it with zeros to make it the same length as the echo file size.
(a)Plot the impulse response of the system in the time domain using Matlab; use impz and then stem. Fromthe plot can you tell what is a, and the number of echoes, and approximately or exactly R.
(b)Submit your code along with a one paragraph comments.(c)Send the pure sound file using Blackboard as an email.