\section{WAVWRITE Write a WAV Audio File}

\subsection{Usage}

The \verb|wavwrite| funtion writes an audio signal to a linear PCM WAV
file.  The simplest form for its use is
\begin{verbatim}
    wavwrite(y,filename)
\end{verbatim}
which writes the data stored in \verb|y| to a WAV file with the name
\verb|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 \verb|y| is written as a separate channel.  The data are clipped to the
range \verb|[-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 \verb|wavwrite| command:
\begin{verbatim}
   wavwrite(y,SampleRate,filename)
\end{verbatim}
where \verb|SampleRate| is in Hz.  Finally, you can specify the number of
bits to use in the output form of the file using the form
\begin{verbatim}
   wavwrite(y,SampleRate,NBits,filename)
\end{verbatim}
where \verb|NBits| is the number of bits to use.  Legal values include
\verb|8,16,24,32|.  For less than 32 bit output format, the data is
truncated to the range \verb|[-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.
