Multiple Microphone/Device Inputs

324 views
Skip to first unread message

Jessie Mindel

unread,
Jun 16, 2021, 4:46:20 PM6/16/21
to pyo-discuss
Hi all! I'm new to Pyo, and am loving it so far! I'm having some difficulty using more than one input source in a single server, and haven't been able to find any info on how to do so in the docs.

From my understanding, Input(x) fetches a stream from channel x of the already specified input device for the server (specified via s.setInputDevice(inputDeviceIndex)). However, I'd like to be able to access multiple input devices rather than only being able to access multiple channels on a single device. I tried Input([deviceIndex0, deviceIndex1]), but this didn't work, either.

Is there any way to do what I'm trying to do? It sounds like Mixer may be what I need, but the examples given of Mixer in the docs don't use Input objects.

Many thanks!

p.s...@outlook.com

unread,
Jun 17, 2021, 9:37:36 AM6/17/21
to pyo-discuss
Hi Jessie,

Each Input uses an index (not a list of indices like you have), e.g. Input(0). s.setInputDevice uses the PortAudio device indices, so I'd start the server and use pa_list_devices() to find out the indices of the recognised input streams, then create input objects with the appropriate index. I don't think you want to use setInputDevice unless you just wanted Input() to get one specific input stream.

Not completely confident I'm right, but that's what I'd try. I use Jack, and use e.g. s.setJackAutoConnectInputPorts([['system:capture_1'],['system:capture_2']]) to define Input(0) as capture_1 (as recognised by Jack) and Input(1) as capture_2.

Best,
Paul

Olivier Bélanger

unread,
Jun 17, 2021, 10:17:54 AM6/17/21
to pyo-d...@googlegroups.com
I can see only two ways to connect to multiple input devices at the same time.

1. With Jack if you're on linux
2. Create an aggregate device in "Audio Midi Setup" if you're on MacOS

Olivier
> --
> You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/297ecbd2-0797-450f-950a-0dd3e9d25884n%40googlegroups.com.

Jessie Mindel

unread,
Jun 21, 2021, 12:39:33 AM6/21/21
to pyo-discuss
Thank you both!

Paul, I had unfortunately already tried your solution, but didn't have much luck. It seems like the parameter for Input is not in fact the input device, but the channel of the input device, which is by default 0.

Olivier, thank you! I tried this with Loopback, and it worked like a charm. Is there any way to determine the number of channels in an input or output device?

Olivier Bélanger

unread,
Jun 21, 2021, 8:08:54 AM6/21/21
to pyo-d...@googlegroups.com
Hi,

On Mon, Jun 21, 2021 at 12:39 AM Jessie Mindel <mindel...@gmail.com> wrote:
>
> Thank you both!
>
> Paul, I had unfortunately already tried your solution, but didn't have much luck. It seems like the parameter for Input is not in fact the input device, but the channel of the input device, which is by default 0.
>
> Olivier, thank you! I tried this with Loopback, and it worked like a charm.

Excellent!

> Is there any way to determine the number of channels in an input or output device?

Try pa_get_input_max_channels and pa_get_output_max_channels functions.

http://ajaxsoundstudio.com/pyodoc/api/functions/audio.html?highlight=pa_get#pa-get-input-max-channels

Olivier

>
> On Thursday, June 17, 2021 at 10:17:54 AM UTC-4 bela...@gmail.com wrote:
>>
>> I can see only two ways to connect to multiple input devices at the same time.
>>
>> 1. With Jack if you're on linux
>> 2. Create an aggregate device in "Audio Midi Setup" if you're on MacOS
>>
>> Olivier
>>
>> On Wed, Jun 16, 2021 at 4:46 PM Jessie Mindel <mindel...@gmail.com> wrote:
>> >
>> > Hi all! I'm new to Pyo, and am loving it so far! I'm having some difficulty using more than one input source in a single server, and haven't been able to find any info on how to do so in the docs.
>> >
>> > From my understanding, Input(x) fetches a stream from channel x of the already specified input device for the server (specified via s.setInputDevice(inputDeviceIndex)). However, I'd like to be able to access multiple input devices rather than only being able to access multiple channels on a single device. I tried Input([deviceIndex0, deviceIndex1]), but this didn't work, either.
>> >
>> > Is there any way to do what I'm trying to do? It sounds like Mixer may be what I need, but the examples given of Mixer in the docs don't use Input objects.
>> >
>> > Many thanks!
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/297ecbd2-0797-450f-950a-0dd3e9d25884n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/97ce8258-51ba-4f29-be2a-83ad6bbfa2f7n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages