mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Small markup and English usage nits.
This commit is contained in:
parent
bfadac00ef
commit
7487c02209
1 changed files with 30 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
|||
% Documentations stolen and LaTeX'ed from comments in file.
|
||||
\section{\module{wave} ---
|
||||
Read and write .WAV files}
|
||||
Read and write WAV files}
|
||||
|
||||
\declaremodule{standard}{wave}
|
||||
\sectionauthor{Moshe Zadka}{mzadka@geocities.com}
|
||||
|
@ -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
|
||||
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}
|
||||
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.
|
|||
|
||||
\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:
|
||||
|
||||
\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}{}
|
||||
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}
|
||||
|
||||
\begin{methoddesc}[Wave_read]{getsampwidth}{}
|
||||
|
@ -68,8 +74,9 @@ Usually \code{'not compressed'} parallels \code{'NONE'}.
|
|||
|
||||
\begin{methoddesc}[Wave_read]{getparams}{}
|
||||
Returns a tuple
|
||||
\code{(nchannels, sampwidth, framerate, nframes, comptype, compname)},
|
||||
equivalent to output of the \code{get} methods.
|
||||
\code{(\var{nchannels}, \var{sampwidth}, \var{framerate},
|
||||
\var{nframes}, \var{comptype}, \var{compname})}, equivalent to output
|
||||
of the \method{get*()} methods.
|
||||
\end{methoddesc}
|
||||
|
||||
\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.
|
|||
Rewind the file pointer to the beginning of the audio stream.
|
||||
\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.
|
||||
|
||||
\begin{methoddesc}[Wave_read]{getmarkers}{}
|
||||
|
@ -102,32 +109,32 @@ Set the file pointer to the specified position.
|
|||
Return current file pointer position.
|
||||
\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}}
|
||||
|
||||
Wave_write objects, as returned by \function{open()} above, have the
|
||||
Wave_write objects, as returned by \function{open()}, have the
|
||||
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}
|
||||
Set the number of channels.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{setsampwidth}{n}
|
||||
Set the sample width (in bytes.)
|
||||
Set the sample width to \var{n} bytes.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{setframerate}{n}
|
||||
Set the frame rate.
|
||||
Set the frame rate to \var{n}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{setnframes}{n}
|
||||
Set the number of frames. This can be later changed, when and if more
|
||||
frames are written.
|
||||
Set the number of frames to \var{n}. This will be changed later if
|
||||
more frames are written.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{setcomptype}{type, name}
|
||||
|
@ -135,15 +142,15 @@ Set the compression type and description.
|
|||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{setparams}{tuple}
|
||||
The \var{tuple} should be
|
||||
\code{(\var{nchannels}, \var{sampwidth}, \var{framerate},
|
||||
\var{nframes}, \var{comptype}, \var{compname})}, with values valid for
|
||||
the \code{set} methods. Set all parameters.
|
||||
The \var{tuple} should be \code{(\var{nchannels}, \var{sampwidth},
|
||||
\var{framerate}, \var{nframes}, \var{comptype}, \var{compname})}, with
|
||||
values valid for the \method{set*()} methods. Sets all parameters.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{tell}{}
|
||||
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}
|
||||
|
||||
\begin{methoddesc}[Wave_write]{writeframesraw}{data}
|
||||
|
@ -154,12 +161,6 @@ Write audio frames, without correcting \var{nframes}.
|
|||
Write audio frames and make sure \var{nframes} is correct.
|
||||
\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
|
||||
\method{writeframes()} or \method{writeframesraw()}, and any attempt
|
||||
to do so will raise an error.
|
||||
to do so will raise \exception{wave.Error}.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue