SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
ECE 569 Digital Signal Processing
Project 2
Name: Weixiong Wang No. A20332258
PART A
Design Object:
Write a function to resample a signal x(n) at sampling conversion by rational factor I/D.I and D
are both positive integers.And design the suitable anti-aliasing filter.The inputs should include
sequence x, I and D and create output sequence y.
Process the resampling by using the provided speech signals: sample2.wav and
sample2_tone.wav. under 2 situations with one “correct” and “incorrect” down sampling.Justify
your answer with corresponding possibly graphs and explain the difference between each of them.
Design Procedure:
 From the problem, 125.01 T and 12 53 T.T  .So we can get the sampling
rate Hz
T
fs 8000
1
1
 .And
7
2
2
1

D
I
T
T .First we get the signal upsampling inserting I–1
zeros between samples;then pass a FIR filter New with characteristic for both interpolation
and decimation as bellow.
7
0
,2
,0
)( {





otherwiseantiH
Then downsample the result from filter by decreasing the sampling rate of signal by keeping
every Dth sample starting with the first sample.Finally,apply the data above to the process,I can
get the result for original signal and resampled signal.
 This part process under a “incorrect” down sampling in which a new sequence at sampling
rate 12 3TT  .Handle the two signals in the same way as part 1,and analysis the result,.Here
filter characteristic becomes:
3
0
,1
,0
)( {





otherwiseantiH
Design Result:
 Below are the results of resampling process in ‘correct’ down sampling,red line represent
origin signal and green line represent resampled signal.As shown in the Figure A.1.1,for the
sample2.wav.After resampling,the resampled signal becomes vague compared to the original
signal,which can be reflected from the figure A.1.1.We can see the loss of quality for signal.
0 0.5 1 1.5 2 2.5
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time(second)
WaveMagnitude
origin
resampled
Figure A.1.1
As for the sample2_tone.wav.Resampling get away the noise and preserve the useful signal to a
certain extent.But the audio performance is a little worse than the first resampled signal,which
means there are more loss during the resampling process,because of the noise,reflected on rhe
figure A.1.2
0 0.5 1 1.5 2 2.5
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time(second)
WaveMagnitude
origin
resampled
Figure A.1.2
Figure A.1.3 is the frequency response comparison between resampled sample2.wav and
sample2_tone.wave.We see that the sample2_tone distorted more than the sample2,which further
illustrate the worse performance of the resampled sample2_tone.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-50
-40
-30
-20
-10
0
10
20
Normalized frequency (  rad/sample)
Magnitude
Comparison of frequency response of two resampled signals
sample2
sample2tone
Figure A.1.3
 This part denote the ‘incorrect’ down sampling,in here 12 3TT  ,this method change the
passband of combined filter become broader than the first one.Figure A.2.1 denotes the
sample2.wav and Figure A.2.2 denotes the sample2_tone.wav. Here we can also find the loss
of quality after resampling.
0 0.5 1 1.5 2 2.5
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time(second)
WaveMagnitude
origin
resampled
Figure A.2.1
And the audio difference is similar to the first part.We can still discern the what the audio said
but it will not that clear,resampling loss and the noise disturb made this happen.
0 0.5 1 1.5 2 2.5
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time(second)
WaveMagnitude origin
resampled
Figure A.2.2
0 0.5 1 1.5 2 2.5
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
Time(second)
SignalMagnitude
correct
incorrect
Figure A.2.3
Figure A.2.3 denotes the difference of sample2.wav under two different sampling rate
conversion.We can find that in ‘correct’ down sampling the signal approximately envelope the
‘incorrect’ signal.Which is more close to original signal.And the audio of ‘incorrect’ is a little
vague than the ‘correct’ one,which reflected in the Figure A.2.4.
Here blue line denotes the original signal,green line denotes correct,red line denotes incorrect.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-50
-40
-30
-20
-10
0
10
20
30
Normalized frequency ( rad/sample)
Magnitude
Comparison of frequency response of two resampled signals
sample2 correct
original signal
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-40
-30
-20
-10
0
10
20
30
Normalized frequency ( rad/sample)
Magnitude
Comparison of frequency response of two resampled signals
sample2 incorrect
original signal
Figure A.2.4
The signal in correct oscillate less than incorrect one,which more accordant to the original one.
Conclusion for part A:
Resampling applies an anti-aliasing (lowpass) FIR filter to the input signal during the
resampling.This causes some errors, including quality loss in the time domain, and some
frequency domain distortions (since the frequency characteristics of these filters is inperfect).
And we can try to improve the sampling rate to make the reconstructed signal performs better,if
we make the sampling rate ratio equal to 1,then we can reconstruct the audio better than the other
cases.
PART B
Design Object:
This part we want to perform the estimation auto-regressive(AR) process signal model by using
the Yule-Walker equations to get the desired model coefficients A.
Then using the sample2_tone.wav to pass a ‘whiten’ filter to obtain )(nw ,and explain the audio
difference between )(nx and )(nw by suitable graphs.
Design Procedure:
 Model coefficients estimation: To solve Yule-Walker equations, we has to know the model
order.Although the Yule-Walker equations can be used to find the model parameters, it cannot
give any insight into the model order N. So we use different order N from small to large to
meet a N that can make the error(noise variance) don’t change significantly when increasing
the order and also the model parameter of the AR process is not-significantly different from
zero.
 Whiten process: Whitening can be done by filtering with a transfer function that is roughly
the inverse of the power spectrum of the signal.It is an attempt to make the spectrum of the
signal "more uniform".
Design Result:
 The estimated model parameters and the noise variances computed by the Yule-Walker
system are given below. It can be ascertained that the estimated parameters are approximately
same as that of what is expected. See how the error decreases as the model order N increases.
The optimum model order in this case is N=7 since the error has not changed significantly
when increasing the order and also the model parameter a7 of the AR(7) process is
not-significantly different from zero.
Below table B.1.1 shows the result.
Model Order(N) Estimated Model
Parameters( ka )
Prediction error
or noise variance(p)
2 [1.0000 -0.0204 0.9804] 0.0061
3 [1.0000 -0.8275 0.9972
-0.8232]
0.0020
4 [1.0000 -1.0420 1.2571
-1.0389 0.2606]
0.0018
5 [1.0000 -0.8954 0.6727
-0.3317 -0.3256 0.5626]
0.0013
6 [1.0000 -0.8007 0.6178
-0.3876 -0.2123 0.4117
0.1684]
0.0012
7 [1.0000 -0.8258 0.5565
-0.3560 -0.1546 0.3197
0.2877 -0.1490]
0.0012
8 [1.0000 -0.8272 0.5592
-0.3530 -0.1560 0.3164
0.2929 -0.1567 0.0094 ]
0.0012
Table B.1.1
 In figure B.2.1.The signal after ‘whiten’ wipe out the noise part and leave the useful part.So
when we listen to the audio after ‘whiten’,we can find that the noise disappear,and we can
identify the noise clearly.But the quality loss can also reflected from the figure because of the
noise and delay of filter.
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
x 10
4
-1
-0.5
0
0.5
1
Tone signal
Frequency
Value
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
x 10
4
-0.5
0
0.5
1
Recovered signal
Frequency
Value
Figure B.2.1
The Power Spectral Density associated with N=7 looks very similar to that the 6th order model
because of the similar coefficients and errors,which we can find in the Figure B.2.2 and we can
see the height of the peak is slightly different,but all of them are sensetive but that determined by
how close the poles of the system are to the unit circle.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-80
-60
-40
-20
0
20
40
Normalized frequency (  rad/sample)
PSD(dB/rad/sample)
Periodogram Power Spectral Density Estimate
PSD estimate of wave
PSD of model output N=2
PSD of model output N=3
PSD of model output N=4
PSD of model output N=5
PSD of model output N=6
PSD of model output N=7
Figure B.2.2
So the Yule-Walker equations give us relationships between autocorrelation and autocovariance
of the process and the AR procsee model parameters that give data can be used to obtain
estimation of an AR model for that particular data like we did here.
Conclusion for part B:
A white noise model is appropriate for the speech signal.Because when we filter it,we can get a
good signal.And because the white noise has a more uniform quality.it’s a wide sense stationary
process.We can get the voice by using the autoregressive modeling to a good enough extent.And
an alternative way to do I think ARMA is a good way to realize it,for we can use AR process to
determine the coefficients and variance first and then using MA model to move out the noise in
the tone signal.
Appendix:
Part A.(Resample)
‘Correct’ way
I = 2;
D = 7;
fs=8000;
f = [0 1/7 1/7 1];
m = [2 2 0 0];
h = fir2(50,f,m)
hd = dfilt.dffir(h)
[wave,fs]=wavread('sample2.wav');
sound(wave,fs);
t1=0:1/fs:(length(wave)-1)/fs;
y1 = upsample(wave,I);
y2 = filter(hd,y1);
y3 = downsample(y2,D)
sound(y3,fs*I/D);
t2=(0:(length(y3)-1))*D/(I*fs);
plot(t1,wave,'r',t2,y3,'-g')
xlabel('Time(second)')
ylabel('Wave Magnitude')
legend('origin','resampled')
‘Incorrect’ way
I = 1;
D = 3;
fs=8000;
f = [0 1/3 1/3 1];
m = [1 1 0 0];
h = fir2(50,f,m)
hd = dfilt.dffir(h)
[wave,fs]=wavread('sample2.wav');
sound(wave,fs);
t1=0:1/fs:(length(wave)-1)/fs;
y1 = upsample(wave,I);
y2 = filter(hd,y1);
y3 = downsample(y2,D)
sound(y3,fs*I/D);
t2=(0:(length(y3)-1))*D/(I*fs);
plot(t1,wave,'r',t2,y3,'-g')
xlabel('Time(second)')
ylabel('Wave Magnitude')
legend('origin','resampled')
Comparison for each two signal to original signal.
I1 = 2;
D1 = 7;
fs=8000;
f1 = [0 1/7 1/7 1];
m1 = [2 2 0 0];
h1 = fir2(50,f1,m1)
[wave,fs]=wavread('sample2.wav');
y1 = upfirdn(wave,h1,I1,D1);
[H1,w1]=freqz(y1);
[H3,w3]=freqz(wave);
plot(w1/pi,20*log10(2*abs(H1)/(2*pi)),'g-',w3/pi,20*log10(2*abs(H3)/(
2*pi)),'b-')
xlabel('Normalized frequency (times pi rad/sample)');
ylabel('Magnitude');
legend('sample2 correct','original signal')
title('Comparison of frequency response of two resampled signals')
Part B
fs=8000
[wave,fs]=wavread('sample2_tone.wav')
[a,e] = aryule(wave,7)
w=filter(a,1,wave)
sound(w,fs);
subplot(211)
plot(wave)
title('Tone signal');
xlabel('Frequency')
ylabel('Value');
subplot(212)
plot(w)
title('Recovered signal');
xlabel('Frequency')
ylabel('Value');
figure(2);
periodogram(wave); hold on; %plot the original frequency response of the
data
N=[2,3,4,5,6,7,8];
set(0,'DefaultAxesColorOrder',[0 0 1;0 1 0;0 1 1;1 0 0;1 0 1;1 1 0;])
for i=1:7,
[a,e] = aryule(wave,N(i))
[H,w]=freqz(sqrt(e),a);
hp = plot(w/pi,20*log10(2*abs(H)/(2*pi))); %plotting in log scale
hold all
end
xlabel('Normalized frequency (times pi rad/sample)');
ylabel('PSD (dB/rad/sample)');
legend('PSD of model output N=2','PSD of model output N=3','PSD of model
output N=4','PSD of model output N=5','PSD of model output N=6','PSD of
model output N=7','PSD of model output N=8');

Contenu connexe

Similaire à ECE 569 project 2

Performance analysis of new proposed window for the improvement of snr & ...
Performance analysis of new proposed window for the improvement of snr & ...Performance analysis of new proposed window for the improvement of snr & ...
Performance analysis of new proposed window for the improvement of snr & ...eSAT Journals
 
lect03-audio-representation.ppt
lect03-audio-representation.pptlect03-audio-representation.ppt
lect03-audio-representation.pptMayankKumar633196
 
lect03-audio-representation.ppt
lect03-audio-representation.pptlect03-audio-representation.ppt
lect03-audio-representation.pptmohan s
 
Building impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturerBuilding impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturerConference Papers
 
Building impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturerBuilding impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturerJournal Papers
 
Computer aided design of communication systems / Simulation Communication Sys...
Computer aided design of communication systems / Simulation Communication Sys...Computer aided design of communication systems / Simulation Communication Sys...
Computer aided design of communication systems / Simulation Communication Sys...Makan Mohammadi
 
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital Converter
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital ConverterDesign of 17-Bit Audio Band Delta-Sigma Analog to Digital Converter
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital ConverterKarthik Rathinavel
 
Detection of Power Line Disturbances using DSP Techniques
Detection of Power Line Disturbances using DSP TechniquesDetection of Power Line Disturbances using DSP Techniques
Detection of Power Line Disturbances using DSP TechniquesKashishVerma18
 
ECE 626 project report Switched Capacitor
ECE 626 project report Switched CapacitorECE 626 project report Switched Capacitor
ECE 626 project report Switched CapacitorKarthik Rathinavel
 
DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...
DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...
DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...sipij
 
LowNoiseAmplifierReport
LowNoiseAmplifierReportLowNoiseAmplifierReport
LowNoiseAmplifierReportSyed Kazmi
 
Design ofexperimentstutorial
Design ofexperimentstutorialDesign ofexperimentstutorial
Design ofexperimentstutorialIngrid McKenzie
 
Audio Signal Processing
Audio Signal Processing Audio Signal Processing
Audio Signal Processing Ahmed A. Arefin
 
Reduction -effect-impulsive-noise-lh
Reduction -effect-impulsive-noise-lhReduction -effect-impulsive-noise-lh
Reduction -effect-impulsive-noise-lhSamir LAKSIR
 
A modern dsp_lockin_amplifier
A modern dsp_lockin_amplifierA modern dsp_lockin_amplifier
A modern dsp_lockin_amplifierSteveHageman3
 
15 www.ni.comConfiguring a Noise Analysis in Multisim.docx
15 www.ni.comConfiguring a Noise Analysis in Multisim.docx15 www.ni.comConfiguring a Noise Analysis in Multisim.docx
15 www.ni.comConfiguring a Noise Analysis in Multisim.docxhyacinthshackley2629
 
PCM and delta modulation.ppt
PCM and delta modulation.pptPCM and delta modulation.ppt
PCM and delta modulation.ppt1637ARUNIMADAS
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital ConvertersAnas Smarty
 
20 28 may17 12jan 14070 28522-1-sm(edit)
20 28 may17 12jan 14070 28522-1-sm(edit)20 28 may17 12jan 14070 28522-1-sm(edit)
20 28 may17 12jan 14070 28522-1-sm(edit)IAESIJEECS
 

Similaire à ECE 569 project 2 (20)

Performance analysis of new proposed window for the improvement of snr & ...
Performance analysis of new proposed window for the improvement of snr & ...Performance analysis of new proposed window for the improvement of snr & ...
Performance analysis of new proposed window for the improvement of snr & ...
 
lect03-audio-representation.ppt
lect03-audio-representation.pptlect03-audio-representation.ppt
lect03-audio-representation.ppt
 
lect03-audio-representation.ppt
lect03-audio-representation.pptlect03-audio-representation.ppt
lect03-audio-representation.ppt
 
Lecture 29
Lecture 29Lecture 29
Lecture 29
 
Building impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturerBuilding impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturer
 
Building impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturerBuilding impedance matching network based on s parameter from manufacturer
Building impedance matching network based on s parameter from manufacturer
 
Computer aided design of communication systems / Simulation Communication Sys...
Computer aided design of communication systems / Simulation Communication Sys...Computer aided design of communication systems / Simulation Communication Sys...
Computer aided design of communication systems / Simulation Communication Sys...
 
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital Converter
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital ConverterDesign of 17-Bit Audio Band Delta-Sigma Analog to Digital Converter
Design of 17-Bit Audio Band Delta-Sigma Analog to Digital Converter
 
Detection of Power Line Disturbances using DSP Techniques
Detection of Power Line Disturbances using DSP TechniquesDetection of Power Line Disturbances using DSP Techniques
Detection of Power Line Disturbances using DSP Techniques
 
ECE 626 project report Switched Capacitor
ECE 626 project report Switched CapacitorECE 626 project report Switched Capacitor
ECE 626 project report Switched Capacitor
 
DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...
DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...
DESIGN REALIZATION AND PERFORMANCE EVALUATION OF AN ACOUSTIC ECHO CANCELLATIO...
 
LowNoiseAmplifierReport
LowNoiseAmplifierReportLowNoiseAmplifierReport
LowNoiseAmplifierReport
 
Design ofexperimentstutorial
Design ofexperimentstutorialDesign ofexperimentstutorial
Design ofexperimentstutorial
 
Audio Signal Processing
Audio Signal Processing Audio Signal Processing
Audio Signal Processing
 
Reduction -effect-impulsive-noise-lh
Reduction -effect-impulsive-noise-lhReduction -effect-impulsive-noise-lh
Reduction -effect-impulsive-noise-lh
 
A modern dsp_lockin_amplifier
A modern dsp_lockin_amplifierA modern dsp_lockin_amplifier
A modern dsp_lockin_amplifier
 
15 www.ni.comConfiguring a Noise Analysis in Multisim.docx
15 www.ni.comConfiguring a Noise Analysis in Multisim.docx15 www.ni.comConfiguring a Noise Analysis in Multisim.docx
15 www.ni.comConfiguring a Noise Analysis in Multisim.docx
 
PCM and delta modulation.ppt
PCM and delta modulation.pptPCM and delta modulation.ppt
PCM and delta modulation.ppt
 
Analog to Digital Converters
Analog to Digital ConvertersAnalog to Digital Converters
Analog to Digital Converters
 
20 28 may17 12jan 14070 28522-1-sm(edit)
20 28 may17 12jan 14070 28522-1-sm(edit)20 28 may17 12jan 14070 28522-1-sm(edit)
20 28 may17 12jan 14070 28522-1-sm(edit)
 

ECE 569 project 2

  • 1. ECE 569 Digital Signal Processing Project 2 Name: Weixiong Wang No. A20332258 PART A Design Object: Write a function to resample a signal x(n) at sampling conversion by rational factor I/D.I and D are both positive integers.And design the suitable anti-aliasing filter.The inputs should include sequence x, I and D and create output sequence y. Process the resampling by using the provided speech signals: sample2.wav and sample2_tone.wav. under 2 situations with one “correct” and “incorrect” down sampling.Justify your answer with corresponding possibly graphs and explain the difference between each of them. Design Procedure:  From the problem, 125.01 T and 12 53 T.T  .So we can get the sampling rate Hz T fs 8000 1 1  .And 7 2 2 1  D I T T .First we get the signal upsampling inserting I–1 zeros between samples;then pass a FIR filter New with characteristic for both interpolation and decimation as bellow. 7 0 ,2 ,0 )( {      otherwiseantiH Then downsample the result from filter by decreasing the sampling rate of signal by keeping every Dth sample starting with the first sample.Finally,apply the data above to the process,I can get the result for original signal and resampled signal.  This part process under a “incorrect” down sampling in which a new sequence at sampling rate 12 3TT  .Handle the two signals in the same way as part 1,and analysis the result,.Here filter characteristic becomes: 3 0 ,1 ,0 )( {      otherwiseantiH
  • 2. Design Result:  Below are the results of resampling process in ‘correct’ down sampling,red line represent origin signal and green line represent resampled signal.As shown in the Figure A.1.1,for the sample2.wav.After resampling,the resampled signal becomes vague compared to the original signal,which can be reflected from the figure A.1.1.We can see the loss of quality for signal. 0 0.5 1 1.5 2 2.5 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Time(second) WaveMagnitude origin resampled Figure A.1.1 As for the sample2_tone.wav.Resampling get away the noise and preserve the useful signal to a certain extent.But the audio performance is a little worse than the first resampled signal,which means there are more loss during the resampling process,because of the noise,reflected on rhe figure A.1.2 0 0.5 1 1.5 2 2.5 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Time(second) WaveMagnitude origin resampled Figure A.1.2
  • 3. Figure A.1.3 is the frequency response comparison between resampled sample2.wav and sample2_tone.wave.We see that the sample2_tone distorted more than the sample2,which further illustrate the worse performance of the resampled sample2_tone. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -50 -40 -30 -20 -10 0 10 20 Normalized frequency (  rad/sample) Magnitude Comparison of frequency response of two resampled signals sample2 sample2tone Figure A.1.3  This part denote the ‘incorrect’ down sampling,in here 12 3TT  ,this method change the passband of combined filter become broader than the first one.Figure A.2.1 denotes the sample2.wav and Figure A.2.2 denotes the sample2_tone.wav. Here we can also find the loss of quality after resampling. 0 0.5 1 1.5 2 2.5 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Time(second) WaveMagnitude origin resampled Figure A.2.1
  • 4. And the audio difference is similar to the first part.We can still discern the what the audio said but it will not that clear,resampling loss and the noise disturb made this happen. 0 0.5 1 1.5 2 2.5 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Time(second) WaveMagnitude origin resampled Figure A.2.2 0 0.5 1 1.5 2 2.5 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 Time(second) SignalMagnitude correct incorrect Figure A.2.3 Figure A.2.3 denotes the difference of sample2.wav under two different sampling rate conversion.We can find that in ‘correct’ down sampling the signal approximately envelope the ‘incorrect’ signal.Which is more close to original signal.And the audio of ‘incorrect’ is a little vague than the ‘correct’ one,which reflected in the Figure A.2.4.
  • 5. Here blue line denotes the original signal,green line denotes correct,red line denotes incorrect. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -50 -40 -30 -20 -10 0 10 20 30 Normalized frequency ( rad/sample) Magnitude Comparison of frequency response of two resampled signals sample2 correct original signal 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -40 -30 -20 -10 0 10 20 30 Normalized frequency ( rad/sample) Magnitude Comparison of frequency response of two resampled signals sample2 incorrect original signal Figure A.2.4 The signal in correct oscillate less than incorrect one,which more accordant to the original one. Conclusion for part A: Resampling applies an anti-aliasing (lowpass) FIR filter to the input signal during the resampling.This causes some errors, including quality loss in the time domain, and some frequency domain distortions (since the frequency characteristics of these filters is inperfect). And we can try to improve the sampling rate to make the reconstructed signal performs better,if we make the sampling rate ratio equal to 1,then we can reconstruct the audio better than the other cases. PART B Design Object: This part we want to perform the estimation auto-regressive(AR) process signal model by using the Yule-Walker equations to get the desired model coefficients A. Then using the sample2_tone.wav to pass a ‘whiten’ filter to obtain )(nw ,and explain the audio difference between )(nx and )(nw by suitable graphs. Design Procedure:  Model coefficients estimation: To solve Yule-Walker equations, we has to know the model order.Although the Yule-Walker equations can be used to find the model parameters, it cannot give any insight into the model order N. So we use different order N from small to large to meet a N that can make the error(noise variance) don’t change significantly when increasing the order and also the model parameter of the AR process is not-significantly different from zero.
  • 6.  Whiten process: Whitening can be done by filtering with a transfer function that is roughly the inverse of the power spectrum of the signal.It is an attempt to make the spectrum of the signal "more uniform". Design Result:  The estimated model parameters and the noise variances computed by the Yule-Walker system are given below. It can be ascertained that the estimated parameters are approximately same as that of what is expected. See how the error decreases as the model order N increases. The optimum model order in this case is N=7 since the error has not changed significantly when increasing the order and also the model parameter a7 of the AR(7) process is not-significantly different from zero. Below table B.1.1 shows the result. Model Order(N) Estimated Model Parameters( ka ) Prediction error or noise variance(p) 2 [1.0000 -0.0204 0.9804] 0.0061 3 [1.0000 -0.8275 0.9972 -0.8232] 0.0020 4 [1.0000 -1.0420 1.2571 -1.0389 0.2606] 0.0018 5 [1.0000 -0.8954 0.6727 -0.3317 -0.3256 0.5626] 0.0013 6 [1.0000 -0.8007 0.6178 -0.3876 -0.2123 0.4117 0.1684] 0.0012 7 [1.0000 -0.8258 0.5565 -0.3560 -0.1546 0.3197 0.2877 -0.1490] 0.0012 8 [1.0000 -0.8272 0.5592 -0.3530 -0.1560 0.3164 0.2929 -0.1567 0.0094 ] 0.0012 Table B.1.1  In figure B.2.1.The signal after ‘whiten’ wipe out the noise part and leave the useful part.So when we listen to the audio after ‘whiten’,we can find that the noise disappear,and we can identify the noise clearly.But the quality loss can also reflected from the figure because of the noise and delay of filter.
  • 7. 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 x 10 4 -1 -0.5 0 0.5 1 Tone signal Frequency Value 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 x 10 4 -0.5 0 0.5 1 Recovered signal Frequency Value Figure B.2.1 The Power Spectral Density associated with N=7 looks very similar to that the 6th order model because of the similar coefficients and errors,which we can find in the Figure B.2.2 and we can see the height of the peak is slightly different,but all of them are sensetive but that determined by how close the poles of the system are to the unit circle. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -80 -60 -40 -20 0 20 40 Normalized frequency (  rad/sample) PSD(dB/rad/sample) Periodogram Power Spectral Density Estimate PSD estimate of wave PSD of model output N=2 PSD of model output N=3 PSD of model output N=4 PSD of model output N=5 PSD of model output N=6 PSD of model output N=7 Figure B.2.2
  • 8. So the Yule-Walker equations give us relationships between autocorrelation and autocovariance of the process and the AR procsee model parameters that give data can be used to obtain estimation of an AR model for that particular data like we did here. Conclusion for part B: A white noise model is appropriate for the speech signal.Because when we filter it,we can get a good signal.And because the white noise has a more uniform quality.it’s a wide sense stationary process.We can get the voice by using the autoregressive modeling to a good enough extent.And an alternative way to do I think ARMA is a good way to realize it,for we can use AR process to determine the coefficients and variance first and then using MA model to move out the noise in the tone signal. Appendix: Part A.(Resample) ‘Correct’ way I = 2; D = 7; fs=8000; f = [0 1/7 1/7 1]; m = [2 2 0 0]; h = fir2(50,f,m) hd = dfilt.dffir(h) [wave,fs]=wavread('sample2.wav'); sound(wave,fs); t1=0:1/fs:(length(wave)-1)/fs; y1 = upsample(wave,I); y2 = filter(hd,y1); y3 = downsample(y2,D) sound(y3,fs*I/D); t2=(0:(length(y3)-1))*D/(I*fs); plot(t1,wave,'r',t2,y3,'-g') xlabel('Time(second)') ylabel('Wave Magnitude') legend('origin','resampled') ‘Incorrect’ way I = 1; D = 3; fs=8000; f = [0 1/3 1/3 1]; m = [1 1 0 0]; h = fir2(50,f,m) hd = dfilt.dffir(h)
  • 9. [wave,fs]=wavread('sample2.wav'); sound(wave,fs); t1=0:1/fs:(length(wave)-1)/fs; y1 = upsample(wave,I); y2 = filter(hd,y1); y3 = downsample(y2,D) sound(y3,fs*I/D); t2=(0:(length(y3)-1))*D/(I*fs); plot(t1,wave,'r',t2,y3,'-g') xlabel('Time(second)') ylabel('Wave Magnitude') legend('origin','resampled') Comparison for each two signal to original signal. I1 = 2; D1 = 7; fs=8000; f1 = [0 1/7 1/7 1]; m1 = [2 2 0 0]; h1 = fir2(50,f1,m1) [wave,fs]=wavread('sample2.wav'); y1 = upfirdn(wave,h1,I1,D1); [H1,w1]=freqz(y1); [H3,w3]=freqz(wave); plot(w1/pi,20*log10(2*abs(H1)/(2*pi)),'g-',w3/pi,20*log10(2*abs(H3)/( 2*pi)),'b-') xlabel('Normalized frequency (times pi rad/sample)'); ylabel('Magnitude'); legend('sample2 correct','original signal') title('Comparison of frequency response of two resampled signals') Part B fs=8000 [wave,fs]=wavread('sample2_tone.wav') [a,e] = aryule(wave,7) w=filter(a,1,wave) sound(w,fs); subplot(211) plot(wave) title('Tone signal'); xlabel('Frequency') ylabel('Value'); subplot(212) plot(w) title('Recovered signal'); xlabel('Frequency')
  • 10. ylabel('Value'); figure(2); periodogram(wave); hold on; %plot the original frequency response of the data N=[2,3,4,5,6,7,8]; set(0,'DefaultAxesColorOrder',[0 0 1;0 1 0;0 1 1;1 0 0;1 0 1;1 1 0;]) for i=1:7, [a,e] = aryule(wave,N(i)) [H,w]=freqz(sqrt(e),a); hp = plot(w/pi,20*log10(2*abs(H)/(2*pi))); %plotting in log scale hold all end xlabel('Normalized frequency (times pi rad/sample)'); ylabel('PSD (dB/rad/sample)'); legend('PSD of model output N=2','PSD of model output N=3','PSD of model output N=4','PSD of model output N=5','PSD of model output N=6','PSD of model output N=7','PSD of model output N=8');