Search code examples
pythonaudiopyo

Using Multiple Input Devices in Python Audio Processing (Pyo)


TLDR: Is there a way to mix multiple input devices' audio streams in real-time in Python (ideally with Pyo)?

I'm trying to use Pyo to combine audio streams from multiple microphones (or virtual microphones, e.g., Loopback devices) into one output audio stream. I've tried using pyo.Input, but it seems to have a core limitation: in Input(x), x seems to refer to a channel, not an input device. The input device seems to be constrained by the server: for s = pyo.Server(duplex=1), s.setInputDevice(someDeviceIndex) seems to be the only way to choose which input device will be used, with x then referring to a channel of that device (e.g., for a stereo microphone).

I have not seen any information in Pyo's docs (or in what I've read about other libraries) about how to mix multiple input devices together. pyo.Mixer seems promising, but examples given in the docs don't demonstrate how to use multiple Inputs, just other sound sources (e.g., a sine wave).

Is there any way that I can access multiple input devices within the scope of one Server and mix them together? If Pyo is not a good option for this task, what other libraries (and/or vanilla Python) might be a good fit?


Solution

  • Resolved on the Pyo forums at this link.