WAVWRITE Write a WAV Audio File
Section: Input/Ouput Functions
Usage
Thewavwrite
funtion writes an audio signal to a linear PCM WAV
file. The simplest form for its use is
wavwrite(y,filename)
which writes the data stored in y
to a WAV file with the name
filename
. By default, the output data is assumed to be sampled at a
rate of 8 KHz, and is output using 16 bit integer format. Each column
of y
is written as a separate channel. The data are clipped to the
range [-1,1]
prior to writing them out. If you want the data to be
written with a different sampling frequency, you can use the following
form of the wavwrite
command:
wavwrite(y,SampleRate,filename)
where SampleRate
is in Hz. Finally, you can specify the number of
bits to use in the output form of the file using the form
wavwrite(y,SampleRate,NBits,filename)
where NBits
is the number of bits to use. Legal values include
8,16,24,32
. For less than 32 bit output format, the data is
truncated to the range [-1,1]
, and an integer output format is used
(type 1 PCM in WAV-speak). For 32 bit output format, the data is
written in type 3 PCM as floating point data.