Is there a limit of input channels in Sound library?

Processing 4, and Sound library

My project  analyzes sound from various channels in a single input device.
It worked fine connecting an external audio interface with two channels.

Now I try to expand the project to work with another external audio interface with 12 input channels.

The interface is correctly installed in W11 and 12 input channels are identified and accesible.
they work fine  with my audio edition programs.

but when I use processing I can access only to 2 first channels.

I use: *AudioIn(parent, in)* where *in* is the number of the desired channel

*Sound.list()* identifies the external interface but only shows 2 inputs and 2 outputs.

is this library limited to 2 channels? missing anything?

thanks

Hi @cento.
I don’t think there is a limit to which input or output channels you can write audio to or read audio from. I don’t use the P4 sound library but look here:
inputDevice() / Libraries / Processing.org
and here:
AudioIn / Libraries / Processing.org
There appears to be nothing that limits which input or output channels you can use. You simply select it in the AudioIn class:

AudioIn in;
int channel = 3; // read audio on input #4
in = new AudioIn(this, channel);
in.play();

thanks @robertesler for your answer.

I think I understand that, but for some reason windows finds all those 12 channels
but P4 sound just finds #0 and #1

maybe the drivers are good for windows but not for P4sound
I don`t know even if that is possible

thanks again

I see what you mean. It works fine with the built-in microphone but when I try to use a third channel on an audio interface it throws a nasty error. I’m wondering if this is a Java Sound issue. Most sound libraries use Java Sound as their audio driver. This makes things easier for integrating with Processing. But it is possible that Java Sound is limited in that way.
You could try just using Jsyn directly: philburk/jsyn
Jsyn is the backend for Processing Sound. PortAudio has a Java Wrapper and there may be some examples of how to use it with Jsyn. PortAudio supports multichannel duplex audio.
The Pd4P3 library also supports PortAudio ( Pd4P3)
But it isn’t set up for multichannel input or output, but it could be relatively easily. PortAudio for Java works fine on Windows but not so great on MacOS.
Probably not the answer you wanted, but I also can’t get it to work as expected.

Hello, Sound library maintainer here :wave:

@robertesler is right that JavaSound is the culprit here, as it has notoriously bad support for multi-channel audio interfaces on Windows. This issue will be addressed (by including PortAudio drivers for Windows) in the v2.4 release of the Sound library, which should become available from the Processing Contribution Manager within the next month or so!

@cento if you are feeling adventurous you could already try the latest test build of the new release from here, which should support access to all audio inputs and outputs of your device: Release v2.4.0-preview · processing/processing-sound · GitHub We would be super grateful about feedback whether everything is working for you, as well as which interface exactly you are using :pray:

The new multi-channel functions are not documented on the Processing website yet, but you can see what methods are available on the Javadoc (and there is also a multi-channel example sketch under Examples > Libraries > Sound > IO).