| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="Wave-write-objects.html" /> |
| 13 | <link rel="prev" href="module-wave.html" /> |
| 14 | <link rel="parent" href="module-wave.html" /> |
| 15 | <link rel="next" href="Wave-write-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>14.5.1 Wave_read Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="14.5 wave " |
| 25 | href="module-wave.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="14.5 wave " |
| 28 | href="module-wave.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="14.5.2 Wave_write Objects" |
| 31 | href="Wave-write-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-wave.html">14.5 wave </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-wave.html">14.5 wave </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="Wave-write-objects.html">14.5.2 Wave_write Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0016510000000000000000"></A><A NAME="Wave-read-objects"></A> |
| 56 | <BR> |
| 57 | 14.5.1 Wave_read Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | Wave_read objects, as returned by <tt class="function">open()</tt>, have the |
| 62 | following methods: |
| 63 | |
| 64 | <P> |
| 65 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 66 | <td><nobr><b><tt id='l2h-4711' xml:id='l2h-4711' class="method">close</tt></b>(</nobr></td> |
| 67 | <td><var></var>)</td></tr></table></dt> |
| 68 | <dd> |
| 69 | Close the stream, and make the instance unusable. This is |
| 70 | called automatically on object collection. |
| 71 | </dl> |
| 72 | |
| 73 | <P> |
| 74 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 75 | <td><nobr><b><tt id='l2h-4712' xml:id='l2h-4712' class="method">getnchannels</tt></b>(</nobr></td> |
| 76 | <td><var></var>)</td></tr></table></dt> |
| 77 | <dd> |
| 78 | Returns number of audio channels (<code>1</code> for mono, <code>2</code> for |
| 79 | stereo). |
| 80 | </dl> |
| 81 | |
| 82 | <P> |
| 83 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 84 | <td><nobr><b><tt id='l2h-4713' xml:id='l2h-4713' class="method">getsampwidth</tt></b>(</nobr></td> |
| 85 | <td><var></var>)</td></tr></table></dt> |
| 86 | <dd> |
| 87 | Returns sample width in bytes. |
| 88 | </dl> |
| 89 | |
| 90 | <P> |
| 91 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 92 | <td><nobr><b><tt id='l2h-4714' xml:id='l2h-4714' class="method">getframerate</tt></b>(</nobr></td> |
| 93 | <td><var></var>)</td></tr></table></dt> |
| 94 | <dd> |
| 95 | Returns sampling frequency. |
| 96 | </dl> |
| 97 | |
| 98 | <P> |
| 99 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 100 | <td><nobr><b><tt id='l2h-4715' xml:id='l2h-4715' class="method">getnframes</tt></b>(</nobr></td> |
| 101 | <td><var></var>)</td></tr></table></dt> |
| 102 | <dd> |
| 103 | Returns number of audio frames. |
| 104 | </dl> |
| 105 | |
| 106 | <P> |
| 107 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 108 | <td><nobr><b><tt id='l2h-4716' xml:id='l2h-4716' class="method">getcomptype</tt></b>(</nobr></td> |
| 109 | <td><var></var>)</td></tr></table></dt> |
| 110 | <dd> |
| 111 | Returns compression type (<code>'NONE'</code> is the only supported type). |
| 112 | </dl> |
| 113 | |
| 114 | <P> |
| 115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 116 | <td><nobr><b><tt id='l2h-4717' xml:id='l2h-4717' class="method">getcompname</tt></b>(</nobr></td> |
| 117 | <td><var></var>)</td></tr></table></dt> |
| 118 | <dd> |
| 119 | Human-readable version of <tt class="method">getcomptype()</tt>. |
| 120 | Usually <code>'not compressed'</code> parallels <code>'NONE'</code>. |
| 121 | </dl> |
| 122 | |
| 123 | <P> |
| 124 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 125 | <td><nobr><b><tt id='l2h-4718' xml:id='l2h-4718' class="method">getparams</tt></b>(</nobr></td> |
| 126 | <td><var></var>)</td></tr></table></dt> |
| 127 | <dd> |
| 128 | Returns a tuple |
| 129 | <code>(<var>nchannels</var>, <var>sampwidth</var>, <var>framerate</var>, |
| 130 | <var>nframes</var>, <var>comptype</var>, <var>compname</var>)</code>, equivalent to output |
| 131 | of the <tt class="method">get*()</tt> methods. |
| 132 | </dl> |
| 133 | |
| 134 | <P> |
| 135 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 136 | <td><nobr><b><tt id='l2h-4719' xml:id='l2h-4719' class="method">readframes</tt></b>(</nobr></td> |
| 137 | <td><var>n</var>)</td></tr></table></dt> |
| 138 | <dd> |
| 139 | Reads and returns at most <var>n</var> frames of audio, as a string of bytes. |
| 140 | </dl> |
| 141 | |
| 142 | <P> |
| 143 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 144 | <td><nobr><b><tt id='l2h-4720' xml:id='l2h-4720' class="method">rewind</tt></b>(</nobr></td> |
| 145 | <td><var></var>)</td></tr></table></dt> |
| 146 | <dd> |
| 147 | Rewind the file pointer to the beginning of the audio stream. |
| 148 | </dl> |
| 149 | |
| 150 | <P> |
| 151 | The following two methods are defined for compatibility with the |
| 152 | <tt class="module"><a href="module-aifc.html">aifc</a></tt> module, and don't do anything interesting. |
| 153 | |
| 154 | <P> |
| 155 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 156 | <td><nobr><b><tt id='l2h-4721' xml:id='l2h-4721' class="method">getmarkers</tt></b>(</nobr></td> |
| 157 | <td><var></var>)</td></tr></table></dt> |
| 158 | <dd> |
| 159 | Returns <code>None</code>. |
| 160 | </dl> |
| 161 | |
| 162 | <P> |
| 163 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 164 | <td><nobr><b><tt id='l2h-4722' xml:id='l2h-4722' class="method">getmark</tt></b>(</nobr></td> |
| 165 | <td><var>id</var>)</td></tr></table></dt> |
| 166 | <dd> |
| 167 | Raise an error. |
| 168 | </dl> |
| 169 | |
| 170 | <P> |
| 171 | The following two methods define a term ``position'' which is compatible |
| 172 | between them, and is otherwise implementation dependent. |
| 173 | |
| 174 | <P> |
| 175 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 176 | <td><nobr><b><tt id='l2h-4723' xml:id='l2h-4723' class="method">setpos</tt></b>(</nobr></td> |
| 177 | <td><var>pos</var>)</td></tr></table></dt> |
| 178 | <dd> |
| 179 | Set the file pointer to the specified position. |
| 180 | </dl> |
| 181 | |
| 182 | <P> |
| 183 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 184 | <td><nobr><b><tt id='l2h-4724' xml:id='l2h-4724' class="method">tell</tt></b>(</nobr></td> |
| 185 | <td><var></var>)</td></tr></table></dt> |
| 186 | <dd> |
| 187 | Return current file pointer position. |
| 188 | </dl> |
| 189 | |
| 190 | <P> |
| 191 | |
| 192 | <DIV CLASS="navigation"> |
| 193 | <div class='online-navigation'> |
| 194 | <p></p><hr /> |
| 195 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 196 | <tr> |
| 197 | <td class='online-navigation'><a rel="prev" title="14.5 wave " |
| 198 | href="module-wave.html"><img src='../icons/previous.png' |
| 199 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 200 | <td class='online-navigation'><a rel="parent" title="14.5 wave " |
| 201 | href="module-wave.html"><img src='../icons/up.png' |
| 202 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 203 | <td class='online-navigation'><a rel="next" title="14.5.2 Wave_write Objects" |
| 204 | href="Wave-write-objects.html"><img src='../icons/next.png' |
| 205 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 206 | <td align="center" width="100%">Python Library Reference</td> |
| 207 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 208 | href="contents.html"><img src='../icons/contents.png' |
| 209 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 210 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 211 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 212 | <td class='online-navigation'><a rel="index" title="Index" |
| 213 | href="genindex.html"><img src='../icons/index.png' |
| 214 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 215 | </tr></table> |
| 216 | <div class='online-navigation'> |
| 217 | <b class="navlabel">Previous:</b> |
| 218 | <a class="sectref" rel="prev" href="module-wave.html">14.5 wave </A> |
| 219 | <b class="navlabel">Up:</b> |
| 220 | <a class="sectref" rel="parent" href="module-wave.html">14.5 wave </A> |
| 221 | <b class="navlabel">Next:</b> |
| 222 | <a class="sectref" rel="next" href="Wave-write-objects.html">14.5.2 Wave_write Objects</A> |
| 223 | </div> |
| 224 | </div> |
| 225 | <hr /> |
| 226 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 227 | </DIV> |
| 228 | <!--End of Navigation Panel--> |
| 229 | <ADDRESS> |
| 230 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 231 | </ADDRESS> |
| 232 | </BODY> |
| 233 | </HTML> |