\section{WAVREAD Read a WAV Audio File}

\subsection{Usage}

The \verb|wavread| function (attempts) to read the contents of a linear PCM
audio WAV file.  This function could definitely use improvements - it is
based on a very simplistic notion of a WAV file.  The simplest form for
its use is
\begin{verbatim}
   y = wavread(filename)
\end{verbatim}
where \verb|filename| is the name of the WAV file to read.  If no extension
is provided, FreeMat will add a '.wav' extension.  This loads the data
from the WAV file into \verb|y|, and returns it in \verb|double| precision,
normalized format.  If you want additional information on, for example,
the WAV sampling rate or bit depth, you can request it via
\begin{verbatim}
  [y, SamplingRate, BitDepth] = wavread(filename)
\end{verbatim}
where \verb|SamplingRate| and \verb|BitDepth| are the sampling rate (in Hz) and
the bit depth of the original data in the WAV file.  If you only want to
load part of the WAV file, you can use
\begin{verbatim}
  [...] = wavread(filename, N)
\end{verbatim}
where \verb|N| indicates the number of samples to read from the file.
Alternately, you can indicate a range of samples to load via
\begin{verbatim}
  [...] = wavread(filename, [N1 N2])
\end{verbatim}
which returns only the indicated samples from each channel in the file.
By default, the output format is \verb|double| precision.  You can cntrol
the format of the output by indicating
\begin{verbatim}
  [...] = wavread(filename, format)
\end{verbatim}
where \verb|format| is either \verb|'double'| for double precision output, or
\verb|'native'| for native precision output (meaning whatever bitdepth that
was present in the original file).  Finally, you can use the \verb|'size'| flag
\begin{verbatim}
  y_siz = wavread(filename,'size')
\end{verbatim}
which returns a vector \verb|[samples channels]| indicating the size of the
data present in the WAV file.
