1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>WAVWRITE Write a WAV Audio File
</TITLE>
</HEAD>
<BODY>
<H2>WAVWRITE Write a WAV Audio File
</H2>
<P>
Section: <A HREF=sec_io.html> Input/Ouput Functions </A>
<H3>Usage</H3>
The <code>wavwrite</code> funtion writes an audio signal to a linear PCM WAV
file. The simplest form for its use is
<PRE>
wavwrite(y,filename)
</PRE>
<P>
which writes the data stored in <code>y</code> to a WAV file with the name
<code>filename</code>. 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 <code>y</code> is written as a separate channel. The data are clipped to the
range <code>[-1,1]</code> 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 <code>wavwrite</code> command:
<PRE>
wavwrite(y,SampleRate,filename)
</PRE>
<P>
where <code>SampleRate</code> is in Hz. Finally, you can specify the number of
bits to use in the output form of the file using the form
<PRE>
wavwrite(y,SampleRate,NBits,filename)
</PRE>
<P>
where <code>NBits</code> is the number of bits to use. Legal values include
<code>8,16,24,32</code>. For less than 32 bit output format, the data is
truncated to the range <code>[-1,1]</code>, 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.
</BODY>
</HTML>
|