140 likes | 320 Views
MATLAB Session 7. ES 156 Signals and Systems 2007 HSEAS. Prepared by Jiajun Gu. Outline. Speech signal processing Filter design. *.wav file. *.wav file: a file format for storing digital audio (waveform) data Information in a *.wav file: Sampling frequency Number of bits per sample
E N D
MATLAB Session 7 ES 156 Signals and Systems 2007 HSEAS Prepared by Jiajun Gu
Outline • Speech signal processing • Filter design
*.wav file • *.wav file: a file format for storing digital audio (waveform) data • Information in a *.wav file: • Sampling frequency • Number of bits per sample • # of Channels: mono, stereo
Read a wav file to matlab • Download the test.wav from course website. • Play it in windows media player or realplayer, or any player software. • Load it into MATLAB y=wavread(‘filename’); [y,fs,bits]=wavread(‘filename’)
Play a wav file in matlab [y,fs,bits]=wavread('test.wav'); wavplay(y,fs); Or use sound sound(y,fs); Plot the speech data (n=1001 to n=2000)
Frequency domain Y_omega=fft(y,4096); Y_omega=fftshift(Y_omega); figure;plot(abs(Y_omega));
Frequency domain –mapping to frequency domain figure; plot(linspace(-fs,fs,4096),abs(Y_omega)); axis tight;
Listen to the signal with different frequencies sound(y,fs); sound(y,fs*2); sound(y,fs*4); sound(y,fs/2); sound(y,fs/4);
Filter design • Ideal filters do not exist in reality • Nonideal filters are of great importance in practical • Filter prototype: • A set of classic low-pass filters, with cut off frequency at 1Hz • The forms of the frequency response are given for engineering design.
Design a low-pass filter • Bessel filter [b,a]=besself(5,100) freqs(b,a)
Design a low-pass filter • Butterworth filter [b,a]=butter(5,100,’s’); freqs(b,a)
Design a high-pass filter [b,a]=besself(5,100,’high’) freqs(b,a)