| 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="au-write-objects.html" /> |
| 13 | <link rel="prev" href="module-sunau.html" /> |
| 14 | <link rel="parent" href="module-sunau.html" /> |
| 15 | <link rel="next" href="au-write-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>14.4.1 AU_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.4 sunau " |
| 25 | href="module-sunau.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.4 sunau " |
| 28 | href="module-sunau.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.4.2 AU_write Objects" |
| 31 | href="au-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-sunau.html">14.4 sunau </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-sunau.html">14.4 sunau </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="au-write-objects.html">14.4.2 AU_write Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0016410000000000000000"></A><A NAME="au-read-objects"></A> |
| 56 | <BR> |
| 57 | 14.4.1 AU_read Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | AU_read objects, as returned by <tt class="function">open()</tt> above, 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-4683' xml:id='l2h-4683' 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 deletion.) |
| 71 | </dl> |
| 72 | |
| 73 | <P> |
| 74 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 75 | <td><nobr><b><tt id='l2h-4684' xml:id='l2h-4684' class="method">getnchannels</tt></b>(</nobr></td> |
| 76 | <td><var></var>)</td></tr></table></dt> |
| 77 | <dd> |
| 78 | Returns number of audio channels (1 for mone, 2 for stereo). |
| 79 | </dl> |
| 80 | |
| 81 | <P> |
| 82 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 83 | <td><nobr><b><tt id='l2h-4685' xml:id='l2h-4685' class="method">getsampwidth</tt></b>(</nobr></td> |
| 84 | <td><var></var>)</td></tr></table></dt> |
| 85 | <dd> |
| 86 | Returns sample width in bytes. |
| 87 | </dl> |
| 88 | |
| 89 | <P> |
| 90 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 91 | <td><nobr><b><tt id='l2h-4686' xml:id='l2h-4686' class="method">getframerate</tt></b>(</nobr></td> |
| 92 | <td><var></var>)</td></tr></table></dt> |
| 93 | <dd> |
| 94 | Returns sampling frequency. |
| 95 | </dl> |
| 96 | |
| 97 | <P> |
| 98 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 99 | <td><nobr><b><tt id='l2h-4687' xml:id='l2h-4687' class="method">getnframes</tt></b>(</nobr></td> |
| 100 | <td><var></var>)</td></tr></table></dt> |
| 101 | <dd> |
| 102 | Returns number of audio frames. |
| 103 | </dl> |
| 104 | |
| 105 | <P> |
| 106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 107 | <td><nobr><b><tt id='l2h-4688' xml:id='l2h-4688' class="method">getcomptype</tt></b>(</nobr></td> |
| 108 | <td><var></var>)</td></tr></table></dt> |
| 109 | <dd> |
| 110 | Returns compression type. |
| 111 | Supported compression types are <code>'ULAW'</code>, <code>'ALAW'</code> and <code>'NONE'</code>. |
| 112 | </dl> |
| 113 | |
| 114 | <P> |
| 115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 116 | <td><nobr><b><tt id='l2h-4689' xml:id='l2h-4689' 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 | The supported types have the respective names <code>'CCITT G.711 |
| 121 | u-law'</code>, <code>'CCITT G.711 A-law'</code> and <code>'not compressed'</code>. |
| 122 | </dl> |
| 123 | |
| 124 | <P> |
| 125 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 126 | <td><nobr><b><tt id='l2h-4690' xml:id='l2h-4690' class="method">getparams</tt></b>(</nobr></td> |
| 127 | <td><var></var>)</td></tr></table></dt> |
| 128 | <dd> |
| 129 | Returns a tuple <code>(<var>nchannels</var>, <var>sampwidth</var>, |
| 130 | <var>framerate</var>, <var>nframes</var>, <var>comptype</var>, <var>compname</var>)</code>, |
| 131 | equivalent to output 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-4691' xml:id='l2h-4691' 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 |
| 140 | bytes. The data will be returned in linear format. If the original |
| 141 | data is in u-LAW format, it will be converted. |
| 142 | </dl> |
| 143 | |
| 144 | <P> |
| 145 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 146 | <td><nobr><b><tt id='l2h-4692' xml:id='l2h-4692' class="method">rewind</tt></b>(</nobr></td> |
| 147 | <td><var></var>)</td></tr></table></dt> |
| 148 | <dd> |
| 149 | Rewind the file pointer to the beginning of the audio stream. |
| 150 | </dl> |
| 151 | |
| 152 | <P> |
| 153 | The following two methods define a term ``position'' which is compatible |
| 154 | between them, and is otherwise implementation dependent. |
| 155 | |
| 156 | <P> |
| 157 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 158 | <td><nobr><b><tt id='l2h-4693' xml:id='l2h-4693' class="method">setpos</tt></b>(</nobr></td> |
| 159 | <td><var>pos</var>)</td></tr></table></dt> |
| 160 | <dd> |
| 161 | Set the file pointer to the specified position. Only values returned |
| 162 | from <tt class="method">tell()</tt> should be used for <var>pos</var>. |
| 163 | </dl> |
| 164 | |
| 165 | <P> |
| 166 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 167 | <td><nobr><b><tt id='l2h-4694' xml:id='l2h-4694' class="method">tell</tt></b>(</nobr></td> |
| 168 | <td><var></var>)</td></tr></table></dt> |
| 169 | <dd> |
| 170 | Return current file pointer position. Note that the returned value |
| 171 | has nothing to do with the actual position in the file. |
| 172 | </dl> |
| 173 | |
| 174 | <P> |
| 175 | The following two functions are defined for compatibility with the |
| 176 | <tt class="module"><a href="module-aifc.html">aifc</a></tt>, and don't do anything interesting. |
| 177 | |
| 178 | <P> |
| 179 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 180 | <td><nobr><b><tt id='l2h-4695' xml:id='l2h-4695' class="method">getmarkers</tt></b>(</nobr></td> |
| 181 | <td><var></var>)</td></tr></table></dt> |
| 182 | <dd> |
| 183 | Returns <code>None</code>. |
| 184 | </dl> |
| 185 | |
| 186 | <P> |
| 187 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 188 | <td><nobr><b><tt id='l2h-4696' xml:id='l2h-4696' class="method">getmark</tt></b>(</nobr></td> |
| 189 | <td><var>id</var>)</td></tr></table></dt> |
| 190 | <dd> |
| 191 | Raise an error. |
| 192 | </dl> |
| 193 | |
| 194 | <P> |
| 195 | |
| 196 | <DIV CLASS="navigation"> |
| 197 | <div class='online-navigation'> |
| 198 | <p></p><hr /> |
| 199 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 200 | <tr> |
| 201 | <td class='online-navigation'><a rel="prev" title="14.4 sunau " |
| 202 | href="module-sunau.html"><img src='../icons/previous.png' |
| 203 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 204 | <td class='online-navigation'><a rel="parent" title="14.4 sunau " |
| 205 | href="module-sunau.html"><img src='../icons/up.png' |
| 206 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 207 | <td class='online-navigation'><a rel="next" title="14.4.2 AU_write Objects" |
| 208 | href="au-write-objects.html"><img src='../icons/next.png' |
| 209 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 210 | <td align="center" width="100%">Python Library Reference</td> |
| 211 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 212 | href="contents.html"><img src='../icons/contents.png' |
| 213 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 214 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 215 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 216 | <td class='online-navigation'><a rel="index" title="Index" |
| 217 | href="genindex.html"><img src='../icons/index.png' |
| 218 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 219 | </tr></table> |
| 220 | <div class='online-navigation'> |
| 221 | <b class="navlabel">Previous:</b> |
| 222 | <a class="sectref" rel="prev" href="module-sunau.html">14.4 sunau </A> |
| 223 | <b class="navlabel">Up:</b> |
| 224 | <a class="sectref" rel="parent" href="module-sunau.html">14.4 sunau </A> |
| 225 | <b class="navlabel">Next:</b> |
| 226 | <a class="sectref" rel="next" href="au-write-objects.html">14.4.2 AU_write Objects</A> |
| 227 | </div> |
| 228 | </div> |
| 229 | <hr /> |
| 230 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 231 | </DIV> |
| 232 | <!--End of Navigation Panel--> |
| 233 | <ADDRESS> |
| 234 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 235 | </ADDRESS> |
| 236 | </BODY> |
| 237 | </HTML> |