user3430848
user3430848

Reputation: 29

How do you specify input channel for multiple mics in pyaudio?

I'm using pyaudio and I'm wondering if there is a way to specify which input channel I'm getting my mic data during playback. So i have speakers and two mics and I want to get each mic signal seperately. Both speakers and mics are using the same soundcard.

Thanks!

basic idea:

while data != ''
      stream.write(data)
      data = wavefile.readframes(chunk)
      data1 = stream.read(ch1_chunk)

Upvotes: 2

Views: 1131

Answers (1)

Matthias
Matthias

Reputation: 4884

What about using http://python-sounddevice.rtfd.org/?

Then you can do something like this:

import sounddevice as sd
myrec = sd.playrec(mydata, input_mapping=[2])

You can specify whatever list of input channels you want to grab.

If you use this in a script, don't forget to use blocking=True.

For more options have a look at the docs for sd.playrec(): http://python-sounddevice.rtfd.org/#sounddevice.playrec.

Upvotes: 1

Related Questions