| 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="prev" href="au-read-objects.html" /> |
| 13 | <link rel="parent" href="module-sunau.html" /> |
| 14 | <link rel="next" href="module-wave.html" /> |
| 15 | <meta name='aesop' content='information' /> |
| 16 | <title>14.4.2 AU_write Objects </title> |
| 17 | </head> |
| 18 | <body> |
| 19 | <DIV CLASS="navigation"> |
| 20 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 21 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 22 | <tr> |
| 23 | <td class='online-navigation'><a rel="prev" title="14.4.1 AU_read Objects" |
| 24 | href="au-read-objects.html"><img src='../icons/previous.png' |
| 25 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 26 | <td class='online-navigation'><a rel="parent" title="14.4 sunau " |
| 27 | href="module-sunau.html"><img src='../icons/up.png' |
| 28 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 29 | <td class='online-navigation'><a rel="next" title="14.5 wave " |
| 30 | href="module-wave.html"><img src='../icons/next.png' |
| 31 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 32 | <td align="center" width="100%">Python Library Reference</td> |
| 33 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 34 | href="contents.html"><img src='../icons/contents.png' |
| 35 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 36 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 37 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 38 | <td class='online-navigation'><a rel="index" title="Index" |
| 39 | href="genindex.html"><img src='../icons/index.png' |
| 40 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 41 | </tr></table> |
| 42 | <div class='online-navigation'> |
| 43 | <b class="navlabel">Previous:</b> |
| 44 | <a class="sectref" rel="prev" href="au-read-objects.html">14.4.1 AU_read Objects</A> |
| 45 | <b class="navlabel">Up:</b> |
| 46 | <a class="sectref" rel="parent" href="module-sunau.html">14.4 sunau </A> |
| 47 | <b class="navlabel">Next:</b> |
| 48 | <a class="sectref" rel="next" href="module-wave.html">14.5 wave </A> |
| 49 | </div> |
| 50 | <hr /></div> |
| 51 | </DIV> |
| 52 | <!--End of Navigation Panel--> |
| 53 | |
| 54 | <H2><A NAME="SECTION0016420000000000000000"></A><A NAME="au-write-objects"></A> |
| 55 | <BR> |
| 56 | 14.4.2 AU_write Objects |
| 57 | </H2> |
| 58 | |
| 59 | <P> |
| 60 | AU_write objects, as returned by <tt class="function">open()</tt> above, have the |
| 61 | following methods: |
| 62 | |
| 63 | <P> |
| 64 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 65 | <td><nobr><b><tt id='l2h-4697' xml:id='l2h-4697' class="method">setnchannels</tt></b>(</nobr></td> |
| 66 | <td><var>n</var>)</td></tr></table></dt> |
| 67 | <dd> |
| 68 | Set the number of channels. |
| 69 | </dl> |
| 70 | |
| 71 | <P> |
| 72 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 73 | <td><nobr><b><tt id='l2h-4698' xml:id='l2h-4698' class="method">setsampwidth</tt></b>(</nobr></td> |
| 74 | <td><var>n</var>)</td></tr></table></dt> |
| 75 | <dd> |
| 76 | Set the sample width (in bytes.) |
| 77 | </dl> |
| 78 | |
| 79 | <P> |
| 80 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 81 | <td><nobr><b><tt id='l2h-4699' xml:id='l2h-4699' class="method">setframerate</tt></b>(</nobr></td> |
| 82 | <td><var>n</var>)</td></tr></table></dt> |
| 83 | <dd> |
| 84 | Set the frame rate. |
| 85 | </dl> |
| 86 | |
| 87 | <P> |
| 88 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 89 | <td><nobr><b><tt id='l2h-4700' xml:id='l2h-4700' class="method">setnframes</tt></b>(</nobr></td> |
| 90 | <td><var>n</var>)</td></tr></table></dt> |
| 91 | <dd> |
| 92 | Set the number of frames. This can be later changed, when and if more |
| 93 | frames are written. |
| 94 | </dl> |
| 95 | |
| 96 | <P> |
| 97 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 98 | <td><nobr><b><tt id='l2h-4701' xml:id='l2h-4701' class="method">setcomptype</tt></b>(</nobr></td> |
| 99 | <td><var>type, name</var>)</td></tr></table></dt> |
| 100 | <dd> |
| 101 | Set the compression type and description. |
| 102 | Only <code>'NONE'</code> and <code>'ULAW'</code> are supported on output. |
| 103 | </dl> |
| 104 | |
| 105 | <P> |
| 106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 107 | <td><nobr><b><tt id='l2h-4702' xml:id='l2h-4702' class="method">setparams</tt></b>(</nobr></td> |
| 108 | <td><var>tuple</var>)</td></tr></table></dt> |
| 109 | <dd> |
| 110 | The <var>tuple</var> should be <code>(<var>nchannels</var>, <var>sampwidth</var>, |
| 111 | <var>framerate</var>, <var>nframes</var>, <var>comptype</var>, <var>compname</var>)</code>, with |
| 112 | values valid for the <tt class="method">set*()</tt> methods. Set all parameters. |
| 113 | </dl> |
| 114 | |
| 115 | <P> |
| 116 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 117 | <td><nobr><b><tt id='l2h-4703' xml:id='l2h-4703' class="method">tell</tt></b>(</nobr></td> |
| 118 | <td><var></var>)</td></tr></table></dt> |
| 119 | <dd> |
| 120 | Return current position in the file, with the same disclaimer for |
| 121 | the <tt class="method">AU_read.tell()</tt> and <tt class="method">AU_read.setpos()</tt> methods. |
| 122 | </dl> |
| 123 | |
| 124 | <P> |
| 125 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 126 | <td><nobr><b><tt id='l2h-4704' xml:id='l2h-4704' class="method">writeframesraw</tt></b>(</nobr></td> |
| 127 | <td><var>data</var>)</td></tr></table></dt> |
| 128 | <dd> |
| 129 | Write audio frames, without correcting <var>nframes</var>. |
| 130 | </dl> |
| 131 | |
| 132 | <P> |
| 133 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 134 | <td><nobr><b><tt id='l2h-4705' xml:id='l2h-4705' class="method">writeframes</tt></b>(</nobr></td> |
| 135 | <td><var>data</var>)</td></tr></table></dt> |
| 136 | <dd> |
| 137 | Write audio frames and make sure <var>nframes</var> is correct. |
| 138 | </dl> |
| 139 | |
| 140 | <P> |
| 141 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 142 | <td><nobr><b><tt id='l2h-4706' xml:id='l2h-4706' class="method">close</tt></b>(</nobr></td> |
| 143 | <td><var></var>)</td></tr></table></dt> |
| 144 | <dd> |
| 145 | Make sure <var>nframes</var> is correct, and close the file. |
| 146 | |
| 147 | <P> |
| 148 | This method is called upon deletion. |
| 149 | </dl> |
| 150 | |
| 151 | <P> |
| 152 | Note that it is invalid to set any parameters after calling |
| 153 | <tt class="method">writeframes()</tt> or <tt class="method">writeframesraw()</tt>. |
| 154 | |
| 155 | <DIV CLASS="navigation"> |
| 156 | <div class='online-navigation'> |
| 157 | <p></p><hr /> |
| 158 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 159 | <tr> |
| 160 | <td class='online-navigation'><a rel="prev" title="14.4.1 AU_read Objects" |
| 161 | href="au-read-objects.html"><img src='../icons/previous.png' |
| 162 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 163 | <td class='online-navigation'><a rel="parent" title="14.4 sunau " |
| 164 | href="module-sunau.html"><img src='../icons/up.png' |
| 165 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 166 | <td class='online-navigation'><a rel="next" title="14.5 wave " |
| 167 | href="module-wave.html"><img src='../icons/next.png' |
| 168 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 169 | <td align="center" width="100%">Python Library Reference</td> |
| 170 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 171 | href="contents.html"><img src='../icons/contents.png' |
| 172 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 173 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 174 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 175 | <td class='online-navigation'><a rel="index" title="Index" |
| 176 | href="genindex.html"><img src='../icons/index.png' |
| 177 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 178 | </tr></table> |
| 179 | <div class='online-navigation'> |
| 180 | <b class="navlabel">Previous:</b> |
| 181 | <a class="sectref" rel="prev" href="au-read-objects.html">14.4.1 AU_read Objects</A> |
| 182 | <b class="navlabel">Up:</b> |
| 183 | <a class="sectref" rel="parent" href="module-sunau.html">14.4 sunau </A> |
| 184 | <b class="navlabel">Next:</b> |
| 185 | <a class="sectref" rel="next" href="module-wave.html">14.5 wave </A> |
| 186 | </div> |
| 187 | </div> |
| 188 | <hr /> |
| 189 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 190 | </DIV> |
| 191 | <!--End of Navigation Panel--> |
| 192 | <ADDRESS> |
| 193 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 194 | </ADDRESS> |
| 195 | </BODY> |
| 196 | </HTML> |