2.3.3 Downsampling:
Implementation
We currently do not support downsampling within the foundation class
environment. At some point, this functionality will be added to the
Filter class. In the interim, we provide two techniques for doing
this that are used widely throughout the industry.
SoX: Soound Exchange
Sox is an extremely useful sound file format converter
that can be acquired from the
Sox Home Page
at
SourceForge.net.
Go to the directory:
$ISIP_TUTORIAL/sections/s02/s02_02_p03/
The example below converts the speech file,
speech raw,
from a sample frequency of 16 kHz to a .au sound file with a sample
frequency of 8 kHz:
sox -t .sw -r 16000 speech.raw -x -t .sw -r 8000 speech_out.raw
Click here
to download a file that you can use to verify your result. Use any
standard Unix tool such as diff or od to compare
your file against our reference.
The general syntax for the SoX command is shown below:
sox -options [input_file] -options [output_file]
Common options are:
-t filetype
|
sets the type of sound sample file,
common filetypes are ".au", ".wav", and ".sw" (signed word)
|
-r rate
|
sets the sample frequency (rate) in Hertz of the file
|
-x
|
reverses the byte order of the file before processing
(known as byte-swapping)
|
Sox is an extremely efficient conversion tool. It seems to give reasonable
performance and is comparable to the Matlab technique discussed below
in terms of recognition performance. Our only concern is that the low
pass filters used in downsampling are not as sharp as those used in Matlab.
Most likely this was done to increase computational efficiency.
MATLAB: Mathematics Laboratory
MATLAB is a tool provided by
The Mathworks
that is very poular within the signal processing communities for doing
signal processing simulations. To downsample data in MATLAB, download
our script called
isip_resample,
and execute using the following command within MATLAB:
isip_resample([input file.list], [output_file.list], [starting sample frequency], [ending sample frequency])
An example of how to use this command is shown below:
isip_resample(speech_in.list, speech_out.list, 16000, 8000)
Click here
to download the result you should obtain, and compare the files using
any standard Unix tool such as diff or od.
|