I am trying to implement a method of PyAudio library, I am suppose to change the default input device since I have connected a USB based Mic to my Laptop and not using the builtin MIC, but I am facing issues doing so,
Here is the complete details of the method,
Help on method open in module pyaudio:
open(self, *args, **kwargs) method of pyaudio.PyAudio instance
Open a new stream. See constructor for
:py:func:`Stream.__init__` for parameter details.
:returns: A new :py:class:`Stream`
.
class pyaudio.Stream(PA_manager, rate, channels, format, input=False, output=False, input_device_index=None, output_device_index=None, frames_per_buffer=1024, start=True, input_host_api_specific_stream_info=None, output_host_api_specific_stream_info=None, stream_callback=None)
PortAudio Stream Wrapper.
Use PyAudio.open()
to make a new Stream.
__init__(PA_manager, rate, channels, format, input=False, output=False, input_device_index=None, output_device_index=None, frames_per_buffer=1024, start=True, input_host_api_specific_stream_info=None, output_host_api_specific_stream_info=None, stream_callback=None)
Initialize a stream; this should be called by
PyAudio.open()
. A stream can either be input, output, or both.
What I want to do is to use
PyAudio.open()
method and set the value of input_device_index=
to 1
But I couldn't understand how to pass the arguments in this function and how to use this init ?
What I have already tried is,
p = pyaudio.PyAudio()
p.open(__init__(input_device_index=1))
But it gives the error.
Here is the complete documentation of the methods, init">http://people.csail.mit.edu/hubert/pyaudio/docs/#pyaudio.Stream.init