Digital Signal Processing Reference
In-Depth Information
0
5
10
15
1
0.5
0
−0.5
−1
20
0
2
6
8
101214161820
4
0
5
10
15
20
k
(s)
k
(s)
(a)
(b)
6.
0
−15
−30
−45
Fig. 17.7. Frequency analysis of
the music signal stored in the
testaudio2.wav
file.
(a) Time representation;
(b) spectrogram; (c) power
spectrum of the music signal.
0
5
10
15
20
f
(kHz)
(c)
Example 17.4
Consider the audio signal stored in the
bell.wav
file, which was sampled
at a sampling rate of 22 050 samples/s and quantized using an 8-bit quantizer.
The power spectral density, shown in Fig. 17.8(b), illustrates that the signal
has frequency components across the entire 0-11 025 Hz frequency range.
We now process the audio signal with the lowpass, highpass, and bandpass
filters.
Lowpass filtering
A lowpass FIR filter with a cut-off frequency of 3 kHz and
order 64 is designed using the
fir1
M
ATLAB
library function. The following
M
ATLAB
code designs the lowpass filter:
>> filtLow = fir1(64,3000/
% Filter: Order = 64
(Fs/2));
% cutoff = 3kHz
>> w = 0:0.001*pi:pi;
% discrete frequencies for
% spectrum
>> HLpf = freqz(filtLow,1,w);
% transfer function
>> plot(w*Fs/(2*pi),20*log10
% magnitude spectrum
(abs(HLpf) + eps));
By default, the
fir1
function uses the Hamming window. Since the
fir1
function accepts normalized frequencies, the cut-off frequency is normalized
with half the sampling frequency. The magnitude spectrum of the resulting
lowpass filter is shown in Fig. 17.9(a).
Search WWH ::
Custom Search