Low-Pass, High-Pass Filters and Their Effects on Speech Signals 1.

advertisement
Lab 9
Low-Pass, High-Pass Filters and Their Effects on Speech Signals
1.
clear;
filename = 'C:\Documents and Settings\jesau\Desktop\Sentence.wav';
[x,fs,bits] = wavread(filename);
t = 0 : 1/fs : (length(x)-1)/fs;
[b,a] = butter(10,1000/(fs/2),'low');
figure; subplot(3,1,1);
plot(t,x,'LineWidth',2);
xlabel('t'); ylabel('x(t)'); title('Original Signal');
y = filter(b,a,x);
subplot(3,1,2);
plot(t,y);
xlabel('t'); ylabel('y(t)'); title('LowPass Filtered Signal');
[d,c] = butter(10,6000/(fs/2),'high');
z = filter(d,c,x);
subplot(3,1,3);
plot(t,z,'LineWidth',2);
xlabel('t'); ylabel('z(t)'); title('HighPass Filtered Signal');
sound(x,fs,bits);
sound(y,fs,bits);
sound(z,fs,bits);
Figure 1
The difference between the original sound signal and the Low-Pass Filtered is that it sounds very
muted and you can only hear the low frequencies in the wave file. But with the High-Pass Filter, the
sound signal is barely audible such that you can only hear the high frequencies that are spoken in the
sound signal such as an “s”. The Low-Pass waveform is shown to display only the low frequencies while
the High-Pass filter is only displaying the high frequencies from the same sound wave.
2.
clear;
filename = 'C:\Documents and Settings\jesau\Desktop\Sentence.wav';
filename2 = 'C:\Documents and Settings\jesau\Desktop\NoisySentence1.wav';
[x,fs,bits] = wavread(filename);
[f,fs,bits2] = wavread(filename2);
t = 0 : 1/fs : (length(x)-1)/fs;
v = 0 : 1/fs : (length(f)-1)/fs;
figure; subplot(4,1,1);
plot(t,x,'LineWidth',2);
xlabel('t'); ylabel('x(t)'); title('Original Signal 1');
subplot(4,1,2);
plot(v,f);
xlabel('t'); ylabel('f(t)'); title('Noisy Signal');
sound(x,fs,bits);
sound(f,fs,bits2);
[b,a] = butter(10,1000/(fs/2),'low');
y = filter(b,a,f);
subplot(4,1,3);
plot(v,y);
xlabel('t'); ylabel('y(t)'); title('Filtered Signal');
sound(y,fs,bits2);
[d,c] = butter(10,5500/(fs/2),'low');
z = filter(d,c,f);
subplot(4,1,4);
plot(v,z,'LineWidth',2);
xlabel('t'); ylabel('z(t)'); title('HighPass Filtered Signal');
sound(z,fs,bits2);
figure; spectrogram(f,512,256,512,fs,'yaxis');
Figure 2
Using the regular Low-Pass Filter, we have removed some of the high frequency noise to create
a more tolerable sound wave. However, it was at a too low cutoff frequency to hear the sound wave
clearly. But with the use of the Spectrogram, I was able to find the proper cutoff frequency in which I
could eliminate the noise to the best possible sound wave available which was at 5.5 kHz. The waveform
of the first filtered signal had too low of a cutoff frequency, and that displayed only the low frequencies.
However, the properly filtered sound wave had gotten rid of all the noise as well as closely resembling
the original noise-free signal.
3.
clear;
filename = 'C:\Documents and Settings\jesau\Desktop\Sentence.wav';
filename2 = 'C:\Documents and Settings\jesau\Desktop\NoisySentence2.wav';
[x,fs,bits] = wavread(filename);
[f,fs,bits2] = wavread(filename2);
t = 0 : 1/fs : (length(x)-1)/fs;
v = 0 : 1/fs : (length(f)-1)/fs;
figure; subplot(3,1,1);
plot(t,x,'LineWidth',2);
xlabel('t'); ylabel('x(t)'); title('Original Signal');
subplot(3,1,2);
plot(v,f);
xlabel('t'); ylabel('f(t)'); title('Noisy Signal');
[b,a] = butter(10,[2781/(fs/2),4344/(fs/2)],'stop');
y = filter(b,a,f);
subplot(3,1,3);
plot(v,y);
xlabel('t'); ylabel('y(t)'); title('Filtered Signal');
sound(x,fs,bits);
sound(f,fs,bits2);
sound(y,fs,bits2);
figure; spectrogram(f,512,256,512,fs,'yaxis');
Figure 3
Figure 4
Using the regular Bandstop Filter, we have removed high frequency noise and low frequency
noise to create a cleaner sound wave. With the use of the Spectrogram, I was able to find the proper
cutoff frequency in which I could eliminate the noise to the best possible sound wave available which
was between 2.781 kHz and 4.344 kHz. Through this method, we were able to create a sound wave that
was similar to the original sound wave.
Download