11% Documentations stolen and LaTeX'ed from comments in file.
22\section {\module {wave} ---
3- Read and write . WAV files }
3+ Read and write WAV files }
44
55\declaremodule {standard}{wave}
66\sectionauthor {Moshe Zadka}{
[email protected] }
@@ -10,7 +10,7 @@ \section{\module{wave} ---
1010format. It does not support compression/decompression, but it does support
1111mono/stereo.
1212
13- The \module {wave} module defines the following function:
13+ The \module {wave} module defines the following function and exception :
1414
1515\begin {funcdesc }{open}{file, mode}
1616If \var {file} is a string, open the file by that name, other treat it
@@ -38,11 +38,17 @@ \section{\module{wave} ---
3838
3939\subsection {Wave_read Objects \label {Wave-read-objects } }
4040
41- Wave_read objects, as returned by \function {open()} above , have the
41+ Wave_read objects, as returned by \function {open()}, have the
4242following methods:
4343
44+ \begin {methoddesc }[Wave_read]{close}{}
45+ Close the stream, and make the instance unusable. This is
46+ called automatically on object collection.
47+ \end {methoddesc }
48+
4449\begin {methoddesc }[Wave_read]{getnchannels}{}
45- Returns number of audio channels (1 for mone, 2 for stereo).
50+ Returns number of audio channels (\code {1} for mono, \code {2} for
51+ stereo).
4652\end {methoddesc }
4753
4854\begin {methoddesc }[Wave_read]{getsampwidth}{}
@@ -68,8 +74,9 @@ \subsection{Wave_read Objects \label{Wave-read-objects}}
6874
6975\begin {methoddesc }[Wave_read]{getparams}{}
7076Returns a tuple
71- \code {(nchannels, sampwidth, framerate, nframes, comptype, compname)},
72- equivalent to output of the \code {get} methods.
77+ \code {(\var {nchannels}, \var {sampwidth}, \var {framerate},
78+ \var {nframes}, \var {comptype}, \var {compname})}, equivalent to output
79+ of the \method {get*()} methods.
7380\end {methoddesc }
7481
7582\begin {methoddesc }[Wave_read]{readframes}{n}
@@ -80,7 +87,7 @@ \subsection{Wave_read Objects \label{Wave-read-objects}}
8087Rewind the file pointer to the beginning of the audio stream.
8188\end {methoddesc }
8289
83- The following two functions are defined for compatibility with the
90+ The following two methods are defined for compatibility with the
8491\refmodule {aifc} module, and don't do anything interesting.
8592
8693\begin {methoddesc }[Wave_read]{getmarkers}{}
@@ -102,48 +109,48 @@ \subsection{Wave_read Objects \label{Wave-read-objects}}
102109Return current file pointer position.
103110\end {methoddesc }
104111
105- \begin {methoddesc }[Wave_read]{close}{}
106- Close the stream, and make the instance unusable. (This is
107- called automatically on deletion.
108- \end {methoddesc }
109-
110112
111113\subsection {Wave_write Objects \label {Wave-write-objects } }
112114
113- Wave_write objects, as returned by \function {open()} above , have the
115+ Wave_write objects, as returned by \function {open()}, have the
114116following methods:
115117
118+ \begin {methoddesc }[Wave_write]{close}{}
119+ Make sure \var {nframes} is correct, and close the file.
120+ This method is called upon deletion.
121+ \end {methoddesc }
122+
116123\begin {methoddesc }[Wave_write]{setnchannels}{n}
117124Set the number of channels.
118125\end {methoddesc }
119126
120127\begin {methoddesc }[Wave_write]{setsampwidth}{n}
121- Set the sample width (in bytes.)
128+ Set the sample width to \var {n} bytes.
122129\end {methoddesc }
123130
124131\begin {methoddesc }[Wave_write]{setframerate}{n}
125- Set the frame rate.
132+ Set the frame rate to \var {n} .
126133\end {methoddesc }
127134
128135\begin {methoddesc }[Wave_write]{setnframes}{n}
129- Set the number of frames. This can be later changed, when and if more
130- frames are written.
136+ Set the number of frames to \var {n} . This will be changed later if
137+ more frames are written.
131138\end {methoddesc }
132139
133140\begin {methoddesc }[Wave_write]{setcomptype}{type, name}
134141Set the compression type and description.
135142\end {methoddesc }
136143
137144\begin {methoddesc }[Wave_write]{setparams}{tuple}
138- The \var {tuple} should be
139- \code {(\var {nchannels}, \var {sampwidth}, \var {framerate},
140- \var {nframes}, \var {comptype}, \var {compname})}, with values valid for
141- the \code {set} methods. Set all parameters.
145+ The \var {tuple} should be \code {(\var {nchannels}, \var {sampwidth},
146+ \var {framerate}, \var {nframes}, \var {comptype}, \var {compname})}, with
147+ values valid for the \method {set*()} methods. Sets all parameters.
142148\end {methoddesc }
143149
144150\begin {methoddesc }[Wave_write]{tell}{}
145151Return current position in the file, with the same disclaimer for
146- the \method {Wave_read.tell} and \method {Wave_read.setpos} methods.
152+ the \method {Wave_read.tell()} and \method {Wave_read.setpos()}
153+ methods.
147154\end {methoddesc }
148155
149156\begin {methoddesc }[Wave_write]{writeframesraw}{data}
@@ -154,12 +161,6 @@ \subsection{Wave_write Objects \label{Wave-write-objects}}
154161Write audio frames and make sure \var {nframes} is correct.
155162\end {methoddesc }
156163
157- \begin {methoddesc }[Wave_write]{close}{}
158- Make sure \var {nframes} is correct, and close the file.
159-
160- This method is called upon deletion.
161- \end {methoddesc }
162-
163164Note that it is invalid to set any parameters after calling
164165\method {writeframes()} or \method {writeframesraw()}, and any attempt
165- to do so will raise an error .
166+ to do so will raise \exception {wave.Error} .
0 commit comments