DSP Blockset    
From Wave File

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.

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, Tfo, is

where Fs 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.

Dialog Box

File name
The path and name of the file to read. Paths can be relative or absolute.
Samples per output frame
The number of samples in each output frame, M.
Minimum number of samples for each read from file
The number of consecutive samples to acquire from the file with each file access, L.

See Also

From Wave Device
DSP Blockset
Signal From Workspace
DSP Blockset
To Wave File
DSP Blockset
wavread
MATLAB

See Importing WAV Files for related information.


 From Wave Device Histogram