Ee338: Digital Signal Processing Computing Assignment # 2
Ee338: Digital Signal Processing Computing Assignment # 2
Question 1: Construct an input discrete-time signal x[n] comprised of 2 components of frequency and amplitude as specified: (f1=100/1024, a1=100.0) and (f2=105/1024, a2=10.0). Plot the DFT magnitude for different window and DFT sizes and comment on your results. Experiment with rectangular and Hamming windows. Find the analysis parameters that give you the best estimates of the signal components (keeping in mind that it is desirable to use the shortest window duration possible). Solution 1: Input Signal: x[n] = 100* sin(2*pi*(100/1024)*n) + 10* sin(2*pi*(105/1024)*n) for n= 0 to 1024 (Say) code: >> n= 0:1:500; >> y= 100* sin(2*pi*(100/1024)*n) + 10* sin(2*pi*(105/1024)*n); >> plot(n,y);
Window:
Window= 50;
Window= 20;
Hamming:
Hamming window
The window is optimized to minimize the maximum (nearest) side lobe, giving it a height of about one-fifth that of the Hann window, a raised cosine with simpler coefficients .
Expression =
>> n= 0:1:500; >> y= 100* sin(2*pi*(100/1024)*n) + 10* sin(2*pi*(105/1024)*n); >> plot(n,y);
Question 2: You are provided recorded samples of the sounds aa and ee spoken by several different speakers. Observe the waveforms and DFT spectra and comment on the similarities and differences between samples. Based on your observations, design an elementary speech recognizer that can distinguish the 2 phonemes (aa & ee). Evaluate the performance of your system on the given data. Solution 2:
2d person:
[y, Fs, bitrate]= wavread('aa2.wav'); sound(y,Fs,bitrate); time = ((1:length(y))/Fs); plot (time,y);
3rd person:
[y, Fs, bitrate]= wavread('aa3.wav'); sound(y,Fs,bitrate); time = ((1:length(y))/Fs); plot (time,y);
4th person:
[y, Fs, bitrate]= wavread('aa4.wav'); sound(y,Fs,bitrate); time = ((1:length(y))/Fs); plot (time,y);
5th person:
[y, Fs, bitrate]= wavread('aa5.wav'); sound(y,Fs,bitrate); time = ((1:length(y))/Fs); plot (time,y);
6th person:
[y, Fs, bitrate]= wavread('fa1.wav'); sound(y,Fs,bitrate); time = ((1:length(y))/Fs); plot (time,y);
Elementary speech recognizer that can distinguish the 2 phonemes (aa & ee).
Algorithm used to differentiate aa and ee, after observing the DFT graphs 1. First I have taken Discrete Fourier Transform of .wav sound data files of different speakers using the above mentioned MATLAB codes. 2. Then after taking Discrete Fourier Transform, I got an 1-D array corresponding to both sounds aa and ee of speaker X, whose magnitude I have stored in another array. 3. Then add the elements of the array into a final value say sumX, and sumY corresponding to both the samples respectively. 4. Now as I have observed the mean square distance from the origin is more in case of aa than ee in all the given samples of sound .wav files. 5. Comparing the mean square distance, we can differentiate the sounds aa and ee if we have the sample data values. This algorithm worked very well and was found to be correct for all the samples given to us.
Here is the check: >> close all; [x, Fs, bitrate]= wavread('aa1.wav'); time = ((1:length(x))/Fs); dx = fft(x); [y, Fs, bitrate]= wavread('ee1.wav'); time = ((1:length(y))/Fs); dy = fft(y); ax=abs(dx); ay=abs(dy); sumx= sum(ax); sumy= sum(ay); p = sumx-sumy; >> p p= 4.2145e+003
>> close all; [x, Fs, bitrate]= wavread('aa2.wav'); time = ((1:length(x))/Fs); dx = fft(x); [y, Fs, bitrate]= wavread('ee2.wav'); time = ((1:length(y))/Fs); dy = fft(y); ax=abs(dx); ay=abs(dy); sumx= sum(ax); sumy= sum(ay); p = sumx-sumy; >> p p= 2.9814e+003 >> close all; [x, Fs, bitrate]= wavread('aa3.wav'); time = ((1:length(x))/Fs); dx = fft(x); [y, Fs, bitrate]= wavread('ee3.wav'); time = ((1:length(y))/Fs); dy = fft(y); ax=abs(dx); ay=abs(dy); sumx= sum(ax); sumy= sum(ay); p = sumx-sumy; >> p p= 1.6418e+003
>> close all; [x, Fs, bitrate]= wavread('aa4.wav'); time = ((1:length(x))/Fs); dx = fft(x); [y, Fs, bitrate]= wavread('ee4.wav'); time = ((1:length(y))/Fs); dy = fft(y); ax=abs(dx); ay=abs(dy); sumx= sum(ax); sumy= sum(ay); p = sumx-sumy; >> p p= 4.0619e+003 >> close all; [x, Fs, bitrate]= wavread('aa5.wav'); time = ((1:length(x))/Fs); dx = fft(x); [y, Fs, bitrate]= wavread('ee5.wav'); time = ((1:length(y))/Fs); dy = fft(y); ax=abs(dx); ay=abs(dy); sumx= sum(ax); sumy= sum(ay); p = sumx-sumy; >> p p= 2.1465e+003
>> close all; [x, Fs, bitrate]= wavread('fa1.wav'); time = ((1:length(x))/Fs); dx = fft(x); [y, Fs, bitrate]= wavread('fee1.wav'); time = ((1:length(y))/Fs); dy = fft(y); ax=abs(dx); ay=abs(dy); sumx= sum(ax); sumy= sum(ay); p = sumx-sumy; >> p p= 2.6433e+003