Cabbage Logo
Back to Cabbage Site

Mixing (a lot of) audio signals

Hi there!

Currently I’m mixing audio signals like this: a1*kgain1 + a2*kgain2, using the + sign. This works fine, making the gain 0.5 and it goes well.

But now I have 10 sigals (a1-a10, WAVs playing simultaneously). To have no distortion, they must be gained with 0.1-ish, except, most of the time the signals will not be generating sound (not all 10 will be played together). This would mean when playing only one signal, it is also gained with 0.1 and the signal sounds quiet. Using chnmix gives the same distorted result (even earlier it seems), I have the feeling it uses the + sign on it’s ow as well.

It’s not like mixing on a mixing desk. When using a mixing desk, all “10 channel gains” might be 0.8, but they are not added in loudness and have distortion (right?)

Maybe I’m getting it all wrong here and is it a consequence of digital mixing. I have tried to find examples in Iain Mccurdy’s library doing the same, but they are also using + and chnmix.

Am I using the wrong approach here or am I totally missing some basic sound (digital) mixing knowledge?

Thanks in advance,
Airell

I’m afraid you will need to roll your own solution here. I often use the + + + approach too. Have you looked at the balance opcode? that might also be useful.

hi, also when using chnmix ,is good idea to use ‘clear’ opcode for a variables

i have mixing 16 voices here, so my output is like this
“outs aoutl* cabbageGetValue:k(“Vol”)*(1/(1+log(cabbageGetValue:k(“unison”))))”
where unison is number of voices.
summing is simple way
aoutl = a1+a2+a3+a4… etc

1 Like

Thanks for the replies.
Using chnmix in instruments creates cleaner code and I had a little bug which actually created a sooner distorted sound with less ‘channels’ (fixed now).
With balance opcode I have to figure out if could get the result. It seems like an ‘auto gain’ function, but I have to watch out for sudden dynamic changes.

Yeah balance can be tricky if you don’t have a good reference level. And there is an issue when one of the signals is 0. It creates a very nice but mostly unwanted feedback.