i have successfully utilized pyaudio to read and record microphone data. I would like to do the same for the soundcard output. (i.e. playing a wavfile and open a stream with pyaudio and read frame by frame the soundcard output).
For reading mic i opened a pyaudio stream like the following
stream = pyaud.open(
format = pyaudio.paInt16,
channels = 1,
rate = 22050,
input_device_index = 0,
input = True)
when i change the input_device_index to 1 i get the following error
IOError: [Errno Invalid number of channels] -9998
Below is the system_info for the macbook soundcard
Default Devices:
================
Default Input Device : 0
defaultSampleRate: 44100.0
defaultLowOutputLatency: 0.01
defaultLowInputLatency: 0.00199546485261
maxInputChannels: 2
structVersion: 2
hostApi: 0 (Core Audio)
index: 0
defaultHighOutputLatency: 0.1
maxOutputChannels: 0
name: Built-in Microph
defaultHighInputLatency: 0.0121541950113
--------------------------------
Default Output Device: 1
defaultSampleRate: 44100.0
defaultLowOutputLatency: 0.00655328798186
defaultLowInputLatency: 0.01
maxInputChannels: 0
structVersion: 2
hostApi: 0 (Core Audio)
index: 1
defaultHighOutputLatency: 0.0167120181406
maxOutputChannels: 2
name: Built-in Output
defaultHighInputLatency: 0.1
--------------------------------