<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>pyaudio.PyAudio</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="pyaudio-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://people.csail.mit.edu/hubert/pyaudio/">PyAudio-0.2.4</a></th> </tr></table></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="pyaudio-module.html">Module pyaudio</a> :: Class PyAudio </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="pyaudio.PyAudio-class.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== CLASS DESCRIPTION ==================== --> <h1 class="epydoc">Class PyAudio</h1><p class="nomargin-top"><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio">source code</a></span></p> <dl class="rst-docutils"> <dt>Python interface to PortAudio. Provides methods to:</dt> <dd><ul class="rst-first rst-last rst-simple"> <li>initialize and terminate PortAudio</li> <li>open and close streams</li> <li>query and inspect the available PortAudio Host APIs</li> <li>query and inspect the available PortAudio audio devices</li> </ul> </dd> </dl> <p>Use this class to open and close streams.</p> <!-- ==================== INSTANCE METHODS ==================== --> <a name="section-InstanceMethods"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Instance Methods</span></td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="__init__"></a><span class="summary-sig-name">__init__</span>(<span class="summary-sig-arg">self</span>)</span><br /> Initialize PortAudio.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.__init__">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#terminate" class="summary-sig-name">terminate</a>(<span class="summary-sig-arg">self</span>)</span><br /> Terminate PortAudio.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.terminate">source code</a></span> </td> </tr> </table> </td> </tr> <tr bgcolor="#e8f0f8" > <th colspan="2" class="group-header" > Stream Management</th></tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#open" class="summary-sig-name">open</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">*args</span>, <span class="summary-sig-arg">**kwargs</span>)</span><br /> Open a new stream. See constructor for <a href="pyaudio.Stream-class.html#__init__" class="link">Stream.__init__</a> for parameter details.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.open">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#close" class="summary-sig-name">close</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">stream</span>)</span><br /> Close a stream. Typically use <a href="pyaudio.Stream-class.html#close" class="link">Stream.close</a> instead.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.close">source code</a></span> </td> </tr> </table> </td> </tr> <tr bgcolor="#e8f0f8" > <th colspan="2" class="group-header" > Host API</th></tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">int</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="get_host_api_count"></a><span class="summary-sig-name">get_host_api_count</span>(<span class="summary-sig-arg">self</span>)</span><br /> Return the number of PortAudio Host APIs.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_host_api_count">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_default_host_api_info" class="summary-sig-name">get_default_host_api_info</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return a dictionary containing the default Host API parameters. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaHostApiInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_default_host_api_info">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_host_api_info_by_type" class="summary-sig-name">get_host_api_info_by_type</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">host_api_type</span>)</span><br /> Return a dictionary containing the Host API parameters for the host API specified by the <code class="link">host_api_type</code>. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaHostApiInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_host_api_info_by_type">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_host_api_info_by_index" class="summary-sig-name">get_host_api_info_by_index</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">host_api_index</span>)</span><br /> Return a dictionary containing the Host API parameters for the host API specified by the <code class="link">host_api_index</code>. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaHostApiInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_host_api_info_by_index">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_device_info_by_host_api_device_index" class="summary-sig-name">get_device_info_by_host_api_device_index</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">host_api_index</span>, <span class="summary-sig-arg">host_api_device_index</span>)</span><br /> Return a dictionary containing the Device parameters for a given Host API's n'th device. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaDeviceInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_device_info_by_host_api_device_index">source code</a></span> </td> </tr> </table> </td> </tr> <tr bgcolor="#e8f0f8" > <th colspan="2" class="group-header" > Device API</th></tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">int</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="get_device_count"></a><span class="summary-sig-name">get_device_count</span>(<span class="summary-sig-arg">self</span>)</span><br /> Return the number of PortAudio Host APIs.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_device_count">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">bool</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#is_format_supported" class="summary-sig-name">is_format_supported</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">rate</span>, <span class="summary-sig-arg">input_device</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">input_channels</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">input_format</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">output_device</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">output_channels</span>=<span class="summary-sig-default">None</span>, <span class="summary-sig-arg">output_format</span>=<span class="summary-sig-default">None</span>)</span><br /> Check to see if specified device configuration is supported. Returns True if the configuration is supported; throws a ValueError exception otherwise.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.is_format_supported">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_default_input_device_info" class="summary-sig-name">get_default_input_device_info</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the default input Device parameters as a dictionary. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaDeviceInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_default_input_device_info">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_default_output_device_info" class="summary-sig-name">get_default_output_device_info</a>(<span class="summary-sig-arg">self</span>)</span><br /> Return the default output Device parameters as a dictionary. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaDeviceInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_default_output_device_info">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">dict</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_device_info_by_index" class="summary-sig-name">get_device_info_by_index</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">device_index</span>)</span><br /> Return the Device parameters for device specified in <code class="link">device_index</code> as a dictionary. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-docutils literal">PaDeviceInfo</tt> structure.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_device_info_by_index">source code</a></span> </td> </tr> </table> </td> </tr> <tr bgcolor="#e8f0f8" > <th colspan="2" class="group-header" > Stream Format Conversion</th></tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type">int</span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_sample_size" class="summary-sig-name">get_sample_size</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">format</span>)</span><br /> Returns the size (in bytes) for the specified sample <code class="link">format</code> (a <a href="pyaudio-module.html#PaSampleFormat" class="link">PaSampleFormat</a> constant).</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_sample_size">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"><a href="pyaudio-module.html#PaSampleFormat" class="link">PaSampleFormat</a></span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="pyaudio.PyAudio-class.html#get_format_from_width" class="summary-sig-name">get_format_from_width</a>(<span class="summary-sig-arg">self</span>, <span class="summary-sig-arg">width</span>, <span class="summary-sig-arg">unsigned</span>=<span class="summary-sig-default">True</span>)</span><br /> Returns a PortAudio format constant for the specified <code class="link">width</code>.</td> <td align="right" valign="top"> <span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_format_from_width">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== METHOD DETAILS ==================== --> <a name="section-MethodDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td align="left" colspan="2" class="table-header"> <span class="table-header">Method Details</span></td> </tr> </table> <a name="terminate"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">terminate</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.terminate">source code</a></span> </td> </tr></table> Terminate PortAudio. <dl class="fields"> </dl> <div class="fields"> <p><strong>Attention:</strong> Be sure to call this method for every instance of this object to release PortAudio resources. </p> </div></td></tr></table> </div> <a name="get_sample_size"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_sample_size</span>(<span class="sig-arg">self</span>, <span class="sig-arg">format</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_sample_size">source code</a></span> </td> </tr></table> Returns the size (in bytes) for the specified sample <code class="link">format</code> (a <a href="pyaudio-module.html#PaSampleFormat" class="link">PaSampleFormat</a> constant). <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>format</code></strong> - Sample format constant (<a href="pyaudio-module.html#PaSampleFormat" class="link">PaSampleFormat</a>).</li> </ul></dd> <dt>Returns: int</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>ValueError</strong></code> - Invalid specified <code class="link">format</code>.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_format_from_width"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_format_from_width</span>(<span class="sig-arg">self</span>, <span class="sig-arg">width</span>, <span class="sig-arg">unsigned</span>=<span class="sig-default">True</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_format_from_width">source code</a></span> </td> </tr></table> Returns a PortAudio format constant for the specified <code class="link">width</code>. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>width</code></strong> - The desired sample width in bytes (1, 2, 3, or 4)</li> <li><strong class="pname"><code>unsigned</code></strong> - For 1 byte width, specifies signed or unsigned format.</li> </ul></dd> <dt>Returns: <a href="pyaudio-module.html#PaSampleFormat" class="link">PaSampleFormat</a></dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>ValueError</strong></code> - for invalid <code class="link">width</code></li> </ul></dd> </dl> </td></tr></table> </div> <a name="open"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">open</span>(<span class="sig-arg">self</span>, <span class="sig-arg">*args</span>, <span class="sig-arg">**kwargs</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.open">source code</a></span> </td> </tr></table> Open a new stream. See constructor for <a href="pyaudio.Stream-class.html#__init__" class="link">Stream.__init__</a> for parameter details. <dl class="fields"> <dt>Returns:</dt> <dd><a href="pyaudio.Stream-class.html" class="link">Stream</a></dd> </dl> </td></tr></table> </div> <a name="close"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">close</span>(<span class="sig-arg">self</span>, <span class="sig-arg">stream</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.close">source code</a></span> </td> </tr></table> Close a stream. Typically use <a href="pyaudio.Stream-class.html#close" class="link">Stream.close</a> instead. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>stream</code></strong> - An instance of the <a href="pyaudio.Stream-class.html" class="link">Stream</a> object.</li> </ul></dd> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>ValueError</strong></code> - if stream does not exist.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_default_host_api_info"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_default_host_api_info</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_default_host_api_info">source code</a></span> </td> </tr></table> Return a dictionary containing the default Host API parameters. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaHostApiInfo</tt> structure. <dl class="fields"> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - if no default input device available</li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_host_api_info_by_type"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_host_api_info_by_type</span>(<span class="sig-arg">self</span>, <span class="sig-arg">host_api_type</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_host_api_info_by_type">source code</a></span> </td> </tr></table> Return a dictionary containing the Host API parameters for the host API specified by the <code class="link">host_api_type</code>. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaHostApiInfo</tt> structure. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>host_api_type</code></strong> - The desired Host API (<a href="pyaudio-module.html#PaHostApiTypeId" class="link">PaHostApiTypeId</a> constant).</li> </ul></dd> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - for invalid <code class="link">host_api_type</code></li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_host_api_info_by_index"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_host_api_info_by_index</span>(<span class="sig-arg">self</span>, <span class="sig-arg">host_api_index</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_host_api_info_by_index">source code</a></span> </td> </tr></table> Return a dictionary containing the Host API parameters for the host API specified by the <code class="link">host_api_index</code>. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaHostApiInfo</tt> structure. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>host_api_index</code></strong> - The host api index.</li> </ul></dd> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - for invalid <code class="link">host_api_index</code></li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_device_info_by_host_api_device_index"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_device_info_by_host_api_device_index</span>(<span class="sig-arg">self</span>, <span class="sig-arg">host_api_index</span>, <span class="sig-arg">host_api_device_index</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_device_info_by_host_api_device_index">source code</a></span> </td> </tr></table> Return a dictionary containing the Device parameters for a given Host API's n'th device. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaDeviceInfo</tt> structure. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>host_api_index</code></strong> - The Host API index number.</li> <li><strong class="pname"><code>host_api_device_index</code></strong> - The <em>n</em> 'th device of the host API.</li> </ul></dd> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - for invalid indices</li> </ul></dd> </dl> </td></tr></table> </div> <a name="is_format_supported"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">is_format_supported</span>(<span class="sig-arg">self</span>, <span class="sig-arg">rate</span>, <span class="sig-arg">input_device</span>=<span class="sig-default">None</span>, <span class="sig-arg">input_channels</span>=<span class="sig-default">None</span>, <span class="sig-arg">input_format</span>=<span class="sig-default">None</span>, <span class="sig-arg">output_device</span>=<span class="sig-default">None</span>, <span class="sig-arg">output_channels</span>=<span class="sig-default">None</span>, <span class="sig-arg">output_format</span>=<span class="sig-default">None</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.is_format_supported">source code</a></span> </td> </tr></table> Check to see if specified device configuration is supported. Returns True if the configuration is supported; throws a ValueError exception otherwise. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>rate</code></strong> - Specifies the desired rate (in Hz)</li> <li><strong class="pname"><code>input_device</code></strong> - The input device index. Specify <code class="link">None</code> (default) for half-duplex output-only streams.</li> <li><strong class="pname"><code>input_channels</code></strong> - The desired number of input channels. Ignored if <code class="link">input_device</code> is not specified (or <code class="link">None</code>).</li> <li><strong class="pname"><code>input_format</code></strong> - PortAudio sample format constant defined in this module</li> <li><strong class="pname"><code>output_device</code></strong> - The output device index. Specify <code class="link">None</code> (default) for half-duplex input-only streams.</li> <li><strong class="pname"><code>output_channels</code></strong> - The desired number of output channels. Ignored if <code class="link">input_device</code> is not specified (or <code class="link">None</code>).</li> <li><strong class="pname"><code>output_format</code></strong> - PortAudio sample format constant (<a href="pyaudio-module.html#PaSampleFormat" class="link">PaSampleFormat</a>).</li> </ul></dd> <dt>Returns: bool</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>ValueError</strong></code> - tuple containing: (error string, PortAudio error code <a href="pyaudio-module.html#PaErrorCode" class="link">PaErrorCode</a>).</li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_default_input_device_info"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_default_input_device_info</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_default_input_device_info">source code</a></span> </td> </tr></table> Return the default input Device parameters as a dictionary. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaDeviceInfo</tt> structure. <dl class="fields"> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - No default input device available.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_default_output_device_info"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_default_output_device_info</span>(<span class="sig-arg">self</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_default_output_device_info">source code</a></span> </td> </tr></table> Return the default output Device parameters as a dictionary. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaDeviceInfo</tt> structure. <dl class="fields"> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - No default output device available.</li> </ul></dd> </dl> </td></tr></table> </div> <a name="get_device_info_by_index"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">get_device_info_by_index</span>(<span class="sig-arg">self</span>, <span class="sig-arg">device_index</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="pyaudio-pysrc.html#PyAudio.get_device_info_by_index">source code</a></span> </td> </tr></table> Return the Device parameters for device specified in <code class="link">device_index</code> as a dictionary. The keys of the dictionary mirror the data fields of PortAudio's <tt class="rst-rst-docutils literal rst-docutils literal">PaDeviceInfo</tt> structure. <dl class="fields"> <dt>Parameters:</dt> <dd><ul class="nomargin-top"> <li><strong class="pname"><code>device_index</code></strong> - The device index.</li> </ul></dd> <dt>Returns: dict</dt> <dt>Raises:</dt> <dd><ul class="nomargin-top"> <li><code><strong class='fraise'>IOError</strong></code> - Invalid <code class="link">device_index</code>.</li> </ul></dd> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="pyaudio-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://people.csail.mit.edu/hubert/pyaudio/">PyAudio-0.2.4</a></th> </tr></table></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Thu Sep 16 04:53:11 2010 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>