User`s guide

From Wave File
5-222
5From Wave File
Purpose Read audio data from a Microsoft Wave (.wav) file. (Windows 95/98/NT only)
Library DSP Sources
Description The From Wave File block reads audio data from a Microsoft Wave (.wav) file
and generates a double-precision signal with amplitudes in the range ±1. The
audio data must be in uncompressed PCM (pulse code modulation) format.
y = wavread('filename') % Equivalent MATLAB code
The File name parameter can specify an absolute or relative path to the file. If
the file is on the MATLAB path or in the current directory (the directory
returned by typing
pwd at the MATLAB command line), you need only specify
the file’s name. You do not need to specify the
.wav extension in either case.
If the audio file contains two channels (stereo), the block’s output is an M-by-2
matrix containing one frame (M consecutive samples) of audio data from each
of the two channels. If the audio file contains a single channel (mono), the
block’s output is an M-by-1 matrix containing one frame (M consecutive
samples) of mono audio data. The frame size, M, is specified by the
Samples
per frame
parameter. For M=1, the output is sample-based; otherwise, the
output is frame-based.
The output frame period, T
fo
, is
,
where F
s
is the data sample rate in Hz.
To reduce the required number of file accesses, the block acquires L consecutive
samples from the file during each access, where L is specified by the
Minimum
number of samples for each read from file
parameter (L M). For L < M, the
block instead acquires M consecutive samples during each access. Larger
values of L result in fewer file accesses, which reduces run-time overhead.
The block icon shows the name, sample rate (in Hz), number of channels
(1 or 2), and sample width (in bits) of the data in the specified audio file. All
sample rates are supported; the sample width must be either 8 or 16 bits.
T
fo
M
F
s
------=