Commit cdeb3e80 authored by Fred Drake's avatar Fred Drake

Small markup and English usage nits.

parent 7588f2c1
% Documentations stolen and LaTeX'ed from comments in file. % Documentations stolen and LaTeX'ed from comments in file.
\section{\module{wave} --- \section{\module{wave} ---
Read and write .WAV files} Read and write WAV files}
\declaremodule{standard}{wave} \declaremodule{standard}{wave}
\sectionauthor{Moshe Zadka}{mzadka@geocities.com} \sectionauthor{Moshe Zadka}{mzadka@geocities.com}
...@@ -10,7 +10,7 @@ The \module{wave} module provides a convenient interface to the WAV sound ...@@ -10,7 +10,7 @@ The \module{wave} module provides a convenient interface to the WAV sound
format. It does not support compression/decompression, but it does support format. It does not support compression/decompression, but it does support
mono/stereo. mono/stereo.
The \module{wave} module defines the following function: The \module{wave} module defines the following function and exception:
\begin{funcdesc}{open}{file, mode} \begin{funcdesc}{open}{file, mode}
If \var{file} is a string, open the file by that name, other treat it If \var{file} is a string, open the file by that name, other treat it
...@@ -38,11 +38,17 @@ WAV specification or hits an implementation deficiency. ...@@ -38,11 +38,17 @@ WAV specification or hits an implementation deficiency.
\subsection{Wave_read Objects \label{Wave-read-objects}} \subsection{Wave_read Objects \label{Wave-read-objects}}
Wave_read objects, as returned by \function{open()} above, have the Wave_read objects, as returned by \function{open()}, have the
following methods: following methods:
\begin{methoddesc}[Wave_read]{close}{}
Close the stream, and make the instance unusable. This is
called automatically on object collection.
\end{methoddesc}
\begin{methoddesc}[Wave_read]{getnchannels}{} \begin{methoddesc}[Wave_read]{getnchannels}{}
Returns number of audio channels (1 for mone, 2 for stereo). Returns number of audio channels (\code{1} for mono, \code{2} for
stereo).
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_read]{getsampwidth}{} \begin{methoddesc}[Wave_read]{getsampwidth}{}
...@@ -68,8 +74,9 @@ Usually \code{'not compressed'} parallels \code{'NONE'}. ...@@ -68,8 +74,9 @@ Usually \code{'not compressed'} parallels \code{'NONE'}.
\begin{methoddesc}[Wave_read]{getparams}{} \begin{methoddesc}[Wave_read]{getparams}{}
Returns a tuple Returns a tuple
\code{(nchannels, sampwidth, framerate, nframes, comptype, compname)}, \code{(\var{nchannels}, \var{sampwidth}, \var{framerate},
equivalent to output of the \code{get} methods. \var{nframes}, \var{comptype}, \var{compname})}, equivalent to output
of the \method{get*()} methods.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_read]{readframes}{n} \begin{methoddesc}[Wave_read]{readframes}{n}
...@@ -80,7 +87,7 @@ Reads and returns at most \var{n} frames of audio, as a string of bytes. ...@@ -80,7 +87,7 @@ Reads and returns at most \var{n} frames of audio, as a string of bytes.
Rewind the file pointer to the beginning of the audio stream. Rewind the file pointer to the beginning of the audio stream.
\end{methoddesc} \end{methoddesc}
The following two functions are defined for compatibility with the The following two methods are defined for compatibility with the
\refmodule{aifc} module, and don't do anything interesting. \refmodule{aifc} module, and don't do anything interesting.
\begin{methoddesc}[Wave_read]{getmarkers}{} \begin{methoddesc}[Wave_read]{getmarkers}{}
...@@ -102,32 +109,32 @@ Set the file pointer to the specified position. ...@@ -102,32 +109,32 @@ Set the file pointer to the specified position.
Return current file pointer position. Return current file pointer position.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_read]{close}{}
Close the stream, and make the instance unusable. (This is
called automatically on deletion.
\end{methoddesc}
\subsection{Wave_write Objects \label{Wave-write-objects}} \subsection{Wave_write Objects \label{Wave-write-objects}}
Wave_write objects, as returned by \function{open()} above, have the Wave_write objects, as returned by \function{open()}, have the
following methods: following methods:
\begin{methoddesc}[Wave_write]{close}{}
Make sure \var{nframes} is correct, and close the file.
This method is called upon deletion.
\end{methoddesc}
\begin{methoddesc}[Wave_write]{setnchannels}{n} \begin{methoddesc}[Wave_write]{setnchannels}{n}
Set the number of channels. Set the number of channels.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{setsampwidth}{n} \begin{methoddesc}[Wave_write]{setsampwidth}{n}
Set the sample width (in bytes.) Set the sample width to \var{n} bytes.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{setframerate}{n} \begin{methoddesc}[Wave_write]{setframerate}{n}
Set the frame rate. Set the frame rate to \var{n}.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{setnframes}{n} \begin{methoddesc}[Wave_write]{setnframes}{n}
Set the number of frames. This can be later changed, when and if more Set the number of frames to \var{n}. This will be changed later if
frames are written. more frames are written.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{setcomptype}{type, name} \begin{methoddesc}[Wave_write]{setcomptype}{type, name}
...@@ -135,15 +142,15 @@ Set the compression type and description. ...@@ -135,15 +142,15 @@ Set the compression type and description.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{setparams}{tuple} \begin{methoddesc}[Wave_write]{setparams}{tuple}
The \var{tuple} should be The \var{tuple} should be \code{(\var{nchannels}, \var{sampwidth},
\code{(\var{nchannels}, \var{sampwidth}, \var{framerate}, \var{framerate}, \var{nframes}, \var{comptype}, \var{compname})}, with
\var{nframes}, \var{comptype}, \var{compname})}, with values valid for values valid for the \method{set*()} methods. Sets all parameters.
the \code{set} methods. Set all parameters.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{tell}{} \begin{methoddesc}[Wave_write]{tell}{}
Return current position in the file, with the same disclaimer for Return current position in the file, with the same disclaimer for
the \method{Wave_read.tell} and \method{Wave_read.setpos} methods. the \method{Wave_read.tell()} and \method{Wave_read.setpos()}
methods.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{writeframesraw}{data} \begin{methoddesc}[Wave_write]{writeframesraw}{data}
...@@ -154,12 +161,6 @@ Write audio frames, without correcting \var{nframes}. ...@@ -154,12 +161,6 @@ Write audio frames, without correcting \var{nframes}.
Write audio frames and make sure \var{nframes} is correct. Write audio frames and make sure \var{nframes} is correct.
\end{methoddesc} \end{methoddesc}
\begin{methoddesc}[Wave_write]{close}{}
Make sure \var{nframes} is correct, and close the file.
This method is called upon deletion.
\end{methoddesc}
Note that it is invalid to set any parameters after calling Note that it is invalid to set any parameters after calling
\method{writeframes()} or \method{writeframesraw()}, and any attempt \method{writeframes()} or \method{writeframesraw()}, and any attempt
to do so will raise an error. to do so will raise \exception{wave.Error}.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment