Patching in RNBO.js with multiple inlets and outlets

David Strobel's icon

Hello RNBO Community,

I am working on a implementation of an audio algorithm that uses the microphone for some adaptive audio purpose.

In my RNBO Patch i have 5 signal inlets, all mono (index 6 - 12 are events inputs) :

  • index 1, in1 -> microphone

  • index 2, in2 -> audiofile1 L channel

  • index 3, in3 -> audiofile1 R channel

  • index 4, in4 -> audiofile2 L channel

  • index 5, in5 -> audiofile2 R channel

I have also 4 signal outlets:

  • index 1, out1 -> output audio1 L channel

  • index 2, out2 -> output audio1 R channel

  • index 3, out3 -> output audio2 L channel

  • index 4, out4 -> output audio2 R channel

RNBO Device has this:
{channelCount: 2, channelCountMode: 'explicit', channelInterpretation: 'discrete'}
but if I analyse the RNBO device via another ScriptProcessor about the channels data I see channelCount: 4 and an array that is basically only on the first place filled with a buffer.

As I am struggle a lot to patch this things correctly together, never had it run without any artifacts.
Can someone explain me where I should look closer to, to get the patching under control?
I use a channelSplitter to get the four signal outputs, but it seems that all the signal output is in the frist channel against what I would expect with my four outlets. Is there another way or a setting I need to change?

When I try to patch all the audioNodes to a specific channel audiosource.connect(device.node, 0, 1) then I cannot hear any audio out (it depends on inlet 2 - 4)
I need to connect audiosource.connect(device.node) directly without adding a concrete in output channel the audio nodes.

I am happy for any help or further explaination what I need to do to mastering the patching in RNBO.
Thank you,

David & Robert


Florian Demmer's icon

Hi there,

let me try to help you here and address a few points from your message.

The information currently reported by device.node is slightly off as you point out and I can confirm that it doesn't match the reality of the node's channel count as reported by the device. This used to be a limitation of the AudioWorklet API but we'll have a look if we can improve that given that the browser implementations had a few iterations.

In general I'd recommend to work on a channel not an input / output basis with RNBO at this point to make things a bit easier to reason about. Currently RNBO in the WebAudio context supports both, channels as well and inputs and does some reassigning internally but that can in fact be a bit misleading and I'd recommend to use one input with multiple channels. In fact, the RNBO node does output on a single outport with multiple channels currently. Using a ChannelMerger and a ChannelSplitter should be helpful here to make this work with your graph and needs.

Have you tried using a simple pass through RNBO patcher, maybe with a gain stage to test the mapping to confirm that it's an issue with the Web implementation / your graph and not the patch?

If you are dealing with multiple channels, i/o in WebAudio I also recommend reading who the API interprets channels and mixing techniques. MDN has a good resource:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Basic_concepts_behind_Web_Audio_API#audio_channels

Let me know if that helps or if you have a small portion of your code to share, happy to take a look.

Thanks