Cabbage Logo
Back to Cabbage Site

How to route stereo input into multiple channel outputs?

In an effect plugin, say I want to take 2 audio inputs, left and right stereo, and distribute them across 16 or 32 or however many left and right stereo channels.

  1. Would it be fine to set nchnls to 16 or 32, if I only want two input channels?
  2. Which of these synchronous output opcodes would be best to duplicate 2 channels into 16 or 32 channels?

I hope my explanation makes sense. I just want to make an audio router / distributor plugin that can send the same audio across different mixer channels in a DAW, but with a sequencer enabling / disabling the routing.

I ought to try doing what I want before asking about it :joy:

I was able to successful distribute a VST instrument into multiple stereo channels in FL Studio, but it’s behaving strangely.

To route 2 channels into 32 channels, I first did a1, a2 inch 1, 2 as the input and then out a1, a2, a1, a2, a1, a2, a1, a2, ... as the output.

I initially set nchnls_i = 2 and nchnls = 32, but FL Studio only saw 2 stereo inputs and outputs. Csound gives a warning about “limiting excess channels”, so I am guessing this is Csound’s doing.
I then set nchnls_i = 32 and FL Studio gave me 16 stereo inputs and outputs. It is routing 1 stereo instrument across 16 stereo channels with no issue, so I guess having 32 inputs in the effect plugin is not a big deal.

After routing the mixer channels to have 1 mixer per output, I started deactivating input and output channels individually in the DAW’s processing settings of the plugin, and this is where it is being weird and giving me concern.
Deactivating at least 1 input or output “downsamples” the audio, to where having only 1 input or output gives the smallest unit of downsampled audio.
From what I understand, the effect plugin is spreading out the audio samples from the stereo input across all of the inputs and outputs.

Is my DAW doing this or is it Csound or Cabbage? How do I get 1 input and 16 outputs correctly? Would doing that solve the issue?

Here is the code I am using:
audioRouteTest.csd (860 Bytes)

I just tested this with Reaper and I see no problem? Could it be an issue with FL Studio? Btw, FWIW, having 32 input channels cost no more than 32 output channels as they share the same data.

1 Like

If that’s the case, then I will keep it as it is and look more into it when the time comes. Thank you Rory!

1 Like