Digital Signal Processing Reference
In-Depth Information
Chapter 10
Applications
T his chapter presents several applications in MATLAB. First, it covers working
with sound and images, including how to show sound as a frequency-domain graph.
Other applications focus on the discrete wavelet transform, and how to design an
FIR lter. This chapter also includes a set of programs to recursively solve a Su
Doku puzzle. Finally, it ends with an example on compression.
10.1
Examples Working with Sound
MATLAB can read and write sound les in the .wav format. Of course, the computer
must have a microphone attached. Unfortunately, at the time of this writing, some of
the .wav features are only available on the Microsoft Windows r version of MATLAB.
The example below records 16,000 samples at 8000 samples/second, as double
values. A little math reveals that this records for two seconds. After recording, the
code plays the sound back.
% record from the microphone
x = wavrecord(16000, 8000, double);
% play it back
wavplay(x)
Running the above code produces an odd-sounding result. Since we did not
specify the sampling rate, MATLAB chose one for us: 11,025 Hz (according to the
help function). We next specify the correct sampling rate.
% play it back at the right sampling rate
wavplay(x, 8000)
339
Search WWH ::




Custom Search