Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / lib / module-wave.html
CommitLineData
86530b38
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="next" href="module-chunk.html" />
13<link rel="prev" href="module-sunau.html" />
14<link rel="parent" href="mmedia.html" />
15<link rel="next" href="Wave-read-objects.html" />
16<meta name='aesop' content='information' />
17<title>14.5 wave -- Read and write WAV files</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.2 AU_write Objects"
25 href="au-write-objects.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. Multimedia Services"
28 href="mmedia.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.1 Wave_read Objects"
31 href="Wave-read-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="au-write-objects.html">14.4.2 AU_write Objects</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="Wave-read-objects.html">14.5.1 Wave_read Objects</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0016500000000000000000">
5614.5 <tt class="module">wave</tt> --
57 Read and write WAV files</A>
58</H1>
59
60<P>
61<A NAME="module-wave"></A>
62
63<P>
64The <tt class="module">wave</tt> module provides a convenient interface to the WAV sound
65format. It does not support compression/decompression, but it does support
66mono/stereo.
67
68<P>
69The <tt class="module">wave</tt> module defines the following function and exception:
70
71<P>
72<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
73 <td><nobr><b><tt id='l2h-4708' xml:id='l2h-4708' class="function">open</tt></b>(</nobr></td>
74 <td><var>file</var><big>[</big><var>, mode</var><big>]</big><var></var>)</td></tr></table></dt>
75<dd>
76If <var>file</var> is a string, open the file by that name, other treat it
77as a seekable file-like object. <var>mode</var> can be any of
78<DL>
79<DT><STRONG><code>'r'</code>, <code>'rb'</code></STRONG></DT>
80<DD>Read only mode.
81
82</DD>
83<DT><STRONG><code>'w'</code>, <code>'wb'</code></STRONG></DT>
84<DD>Write only mode.
85</DD>
86</DL>
87Note that it does not allow read/write WAV files.
88
89<P>
90A <var>mode</var> of <code>'r'</code> or <code>'rb'</code> returns a <tt class="class">Wave_read</tt>
91object, while a <var>mode</var> of <code>'w'</code> or <code>'wb'</code> returns
92a <tt class="class">Wave_write</tt> object. If <var>mode</var> is omitted and a file-like
93object is passed as <var>file</var>, <code><var>file</var>.mode</code> is used as the
94default value for <var>mode</var> (the "<tt class="character">b</tt>" flag is still added if
95necessary).
96</dl>
97
98<P>
99<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
100 <td><nobr><b><tt id='l2h-4709' xml:id='l2h-4709' class="function">openfp</tt></b>(</nobr></td>
101 <td><var>file, mode</var>)</td></tr></table></dt>
102<dd>
103A synonym for <tt class="function">open()</tt>, maintained for backwards compatibility.
104</dl>
105
106<P>
107<dl><dt><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-4710' xml:id='l2h-4710' class="exception">Error</tt></b></dt>
108<dd>
109An error raised when something is impossible because it violates the
110WAV specification or hits an implementation deficiency.
111</dd></dl>
112
113<P>
114
115<p><br /></p><hr class='online-navigation' />
116<div class='online-navigation'>
117<!--Table of Child-Links-->
118<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
119
120<UL CLASS="ChildLinks">
121<LI><A href="Wave-read-objects.html">14.5.1 Wave_read Objects</a>
122<LI><A href="Wave-write-objects.html">14.5.2 Wave_write Objects</a>
123</ul>
124<!--End of Table of Child-Links-->
125</div>
126
127<DIV CLASS="navigation">
128<div class='online-navigation'>
129<p></p><hr />
130<table align="center" width="100%" cellpadding="0" cellspacing="2">
131<tr>
132<td class='online-navigation'><a rel="prev" title="14.4.2 AU_write Objects"
133 href="au-write-objects.html"><img src='../icons/previous.png'
134 border='0' height='32' alt='Previous Page' width='32' /></A></td>
135<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
136 href="mmedia.html"><img src='../icons/up.png'
137 border='0' height='32' alt='Up One Level' width='32' /></A></td>
138<td class='online-navigation'><a rel="next" title="14.5.1 Wave_read Objects"
139 href="Wave-read-objects.html"><img src='../icons/next.png'
140 border='0' height='32' alt='Next Page' width='32' /></A></td>
141<td align="center" width="100%">Python Library Reference</td>
142<td class='online-navigation'><a rel="contents" title="Table of Contents"
143 href="contents.html"><img src='../icons/contents.png'
144 border='0' height='32' alt='Contents' width='32' /></A></td>
145<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
146 border='0' height='32' alt='Module Index' width='32' /></a></td>
147<td class='online-navigation'><a rel="index" title="Index"
148 href="genindex.html"><img src='../icons/index.png'
149 border='0' height='32' alt='Index' width='32' /></A></td>
150</tr></table>
151<div class='online-navigation'>
152<b class="navlabel">Previous:</b>
153<a class="sectref" rel="prev" href="au-write-objects.html">14.4.2 AU_write Objects</A>
154<b class="navlabel">Up:</b>
155<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
156<b class="navlabel">Next:</b>
157<a class="sectref" rel="next" href="Wave-read-objects.html">14.5.1 Wave_read Objects</A>
158</div>
159</div>
160<hr />
161<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
162</DIV>
163<!--End of Navigation Panel-->
164<ADDRESS>
165See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
166</ADDRESS>
167</BODY>
168</HTML>