Commit | Line | Data |
---|---|---|
920dae64 AT |
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="Wave-read-objects.html" /> | |
13 | <link rel="parent" href="module-wave.html" /> | |
14 | <link rel="next" href="module-chunk.html" /> | |
15 | <meta name='aesop' content='information' /> | |
16 | <title>14.5.2 Wave_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.5.1 Wave_read Objects" | |
24 | href="Wave-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.5 wave " | |
27 | href="module-wave.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.6 chunk " | |
30 | href="module-chunk.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="Wave-read-objects.html">14.5.1 Wave_read Objects</A> | |
45 | <b class="navlabel">Up:</b> | |
46 | <a class="sectref" rel="parent" href="module-wave.html">14.5 wave </A> | |
47 | <b class="navlabel">Next:</b> | |
48 | <a class="sectref" rel="next" href="module-chunk.html">14.6 chunk </A> | |
49 | </div> | |
50 | <hr /></div> | |
51 | </DIV> | |
52 | <!--End of Navigation Panel--> | |
53 | ||
54 | <H2><A NAME="SECTION0016520000000000000000"></A><A NAME="Wave-write-objects"></A> | |
55 | <BR> | |
56 | 14.5.2 Wave_write Objects | |
57 | </H2> | |
58 | ||
59 | <P> | |
60 | Wave_write objects, as returned by <tt class="function">open()</tt>, 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-4725' xml:id='l2h-4725' class="method">close</tt></b>(</nobr></td> | |
66 | <td><var></var>)</td></tr></table></dt> | |
67 | <dd> | |
68 | Make sure <var>nframes</var> is correct, and close the file. | |
69 | This method is called upon deletion. | |
70 | </dl> | |
71 | ||
72 | <P> | |
73 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
74 | <td><nobr><b><tt id='l2h-4726' xml:id='l2h-4726' class="method">setnchannels</tt></b>(</nobr></td> | |
75 | <td><var>n</var>)</td></tr></table></dt> | |
76 | <dd> | |
77 | Set the number of channels. | |
78 | </dl> | |
79 | ||
80 | <P> | |
81 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
82 | <td><nobr><b><tt id='l2h-4727' xml:id='l2h-4727' class="method">setsampwidth</tt></b>(</nobr></td> | |
83 | <td><var>n</var>)</td></tr></table></dt> | |
84 | <dd> | |
85 | Set the sample width to <var>n</var> bytes. | |
86 | </dl> | |
87 | ||
88 | <P> | |
89 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
90 | <td><nobr><b><tt id='l2h-4728' xml:id='l2h-4728' class="method">setframerate</tt></b>(</nobr></td> | |
91 | <td><var>n</var>)</td></tr></table></dt> | |
92 | <dd> | |
93 | Set the frame rate to <var>n</var>. | |
94 | </dl> | |
95 | ||
96 | <P> | |
97 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
98 | <td><nobr><b><tt id='l2h-4729' xml:id='l2h-4729' class="method">setnframes</tt></b>(</nobr></td> | |
99 | <td><var>n</var>)</td></tr></table></dt> | |
100 | <dd> | |
101 | Set the number of frames to <var>n</var>. This will be changed later if | |
102 | more frames are written. | |
103 | </dl> | |
104 | ||
105 | <P> | |
106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
107 | <td><nobr><b><tt id='l2h-4730' xml:id='l2h-4730' class="method">setcomptype</tt></b>(</nobr></td> | |
108 | <td><var>type, name</var>)</td></tr></table></dt> | |
109 | <dd> | |
110 | Set the compression type and description. | |
111 | </dl> | |
112 | ||
113 | <P> | |
114 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
115 | <td><nobr><b><tt id='l2h-4731' xml:id='l2h-4731' class="method">setparams</tt></b>(</nobr></td> | |
116 | <td><var>tuple</var>)</td></tr></table></dt> | |
117 | <dd> | |
118 | The <var>tuple</var> should be <code>(<var>nchannels</var>, <var>sampwidth</var>, | |
119 | <var>framerate</var>, <var>nframes</var>, <var>comptype</var>, <var>compname</var>)</code>, with | |
120 | values valid for the <tt class="method">set*()</tt> methods. Sets all parameters. | |
121 | </dl> | |
122 | ||
123 | <P> | |
124 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
125 | <td><nobr><b><tt id='l2h-4732' xml:id='l2h-4732' class="method">tell</tt></b>(</nobr></td> | |
126 | <td><var></var>)</td></tr></table></dt> | |
127 | <dd> | |
128 | Return current position in the file, with the same disclaimer for | |
129 | the <tt class="method">Wave_read.tell()</tt> and <tt class="method">Wave_read.setpos()</tt> | |
130 | methods. | |
131 | </dl> | |
132 | ||
133 | <P> | |
134 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
135 | <td><nobr><b><tt id='l2h-4733' xml:id='l2h-4733' class="method">writeframesraw</tt></b>(</nobr></td> | |
136 | <td><var>data</var>)</td></tr></table></dt> | |
137 | <dd> | |
138 | Write audio frames, without correcting <var>nframes</var>. | |
139 | </dl> | |
140 | ||
141 | <P> | |
142 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
143 | <td><nobr><b><tt id='l2h-4734' xml:id='l2h-4734' class="method">writeframes</tt></b>(</nobr></td> | |
144 | <td><var>data</var>)</td></tr></table></dt> | |
145 | <dd> | |
146 | Write audio frames and make sure <var>nframes</var> is correct. | |
147 | </dl> | |
148 | ||
149 | <P> | |
150 | Note that it is invalid to set any parameters after calling | |
151 | <tt class="method">writeframes()</tt> or <tt class="method">writeframesraw()</tt>, and any attempt | |
152 | to do so will raise <tt class="exception">wave.Error</tt>. | |
153 | ||
154 | <DIV CLASS="navigation"> | |
155 | <div class='online-navigation'> | |
156 | <p></p><hr /> | |
157 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
158 | <tr> | |
159 | <td class='online-navigation'><a rel="prev" title="14.5.1 Wave_read Objects" | |
160 | href="Wave-read-objects.html"><img src='../icons/previous.png' | |
161 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
162 | <td class='online-navigation'><a rel="parent" title="14.5 wave " | |
163 | href="module-wave.html"><img src='../icons/up.png' | |
164 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
165 | <td class='online-navigation'><a rel="next" title="14.6 chunk " | |
166 | href="module-chunk.html"><img src='../icons/next.png' | |
167 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
168 | <td align="center" width="100%">Python Library Reference</td> | |
169 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
170 | href="contents.html"><img src='../icons/contents.png' | |
171 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
172 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
173 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
174 | <td class='online-navigation'><a rel="index" title="Index" | |
175 | href="genindex.html"><img src='../icons/index.png' | |
176 | border='0' height='32' alt='Index' width='32' /></A></td> | |
177 | </tr></table> | |
178 | <div class='online-navigation'> | |
179 | <b class="navlabel">Previous:</b> | |
180 | <a class="sectref" rel="prev" href="Wave-read-objects.html">14.5.1 Wave_read Objects</A> | |
181 | <b class="navlabel">Up:</b> | |
182 | <a class="sectref" rel="parent" href="module-wave.html">14.5 wave </A> | |
183 | <b class="navlabel">Next:</b> | |
184 | <a class="sectref" rel="next" href="module-chunk.html">14.6 chunk </A> | |
185 | </div> | |
186 | </div> | |
187 | <hr /> | |
188 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
189 | </DIV> | |
190 | <!--End of Navigation Panel--> | |
191 | <ADDRESS> | |
192 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
193 | </ADDRESS> | |
194 | </BODY> | |
195 | </HTML> |