notahardwareguy
Active member
I have been experimenting with the audio library and with multiple mixers. I have also reviewed the PlaySynthMusic example but am still confused at to the relationship between combinations of mixer channels and the gain control. The documentation for mixers in the audio design tool is just not helping me.
For the primary mixer control "gain(channel, level)" the documentation says:
Adjust the amplification or attenuation. "channel" must be 0 to 3. (makes perfect sense as there are only 4 inputs to the mixer) "level" may be any floating point number from 0 to 32767.0. (awesome, I have a range to play within) 1.0 passes the signal through directly. (so 1.0 mean "no change", good) Level of 0 shuts the channel off completely. (also good, I can turn an individual channel on and off) Between 0 to 1.0 attenuates the signal, and above 1.0 amplifies it. (so any value above 0 but below 1 acts to dampen the signal to some degree and any value above one amplifies it - so for music 32767 would be bad?) Negative numbers may also be used, to invert the signal. All 4 channels have separate gain settings.
OK, that seems all reasonable and fair. In my case I plan to use all four mixer lines and at any one time have from one to four lines on. I also want every line and combination of lines to be at the original level, no attenuation or amplification by the mixer. Sounds like I would just set all the gain values to 1.0 if I want that channel on and set them to 0.0 if I want them off, yes? For example:
gain( 0, 1.00 ); // on
gain( 1, 0.00 ); // off
gain( 2, 1.00 ); // on
gain( 3, 0.00 ); // off
BUT then the documentation also says:
Signal clipping can occur when any channel has gain greater than 1.0, or when multiple signals add together to greater than 1.0.
NOW I am confused! If I am having more than one channel active, how do I adjust the gain so that they are all mixed at the same "gain" and don't exceed 1? I tried dividing 0.99 by the number of active channels but that does not sound right when I hear it as I change the number/mix of active channels. One channel at 0.99 sounds louder(?) and less muted than two at 0.45. How do I get any combination of active mixer lines to "sound" the same?
I want to take a single digital music signal, send it through various effects and filters, send all that into multiple mixers combining them all together and sending them to the same output. I do send the left and right signals down their own identical paths with identical filter, effect, and mixer settings.
Sorry if I am being an idiot and this should be obvious but I am just not getting it. Can someone explain this to me? Thanks much.
For the primary mixer control "gain(channel, level)" the documentation says:
Adjust the amplification or attenuation. "channel" must be 0 to 3. (makes perfect sense as there are only 4 inputs to the mixer) "level" may be any floating point number from 0 to 32767.0. (awesome, I have a range to play within) 1.0 passes the signal through directly. (so 1.0 mean "no change", good) Level of 0 shuts the channel off completely. (also good, I can turn an individual channel on and off) Between 0 to 1.0 attenuates the signal, and above 1.0 amplifies it. (so any value above 0 but below 1 acts to dampen the signal to some degree and any value above one amplifies it - so for music 32767 would be bad?) Negative numbers may also be used, to invert the signal. All 4 channels have separate gain settings.
OK, that seems all reasonable and fair. In my case I plan to use all four mixer lines and at any one time have from one to four lines on. I also want every line and combination of lines to be at the original level, no attenuation or amplification by the mixer. Sounds like I would just set all the gain values to 1.0 if I want that channel on and set them to 0.0 if I want them off, yes? For example:
gain( 0, 1.00 ); // on
gain( 1, 0.00 ); // off
gain( 2, 1.00 ); // on
gain( 3, 0.00 ); // off
BUT then the documentation also says:
Signal clipping can occur when any channel has gain greater than 1.0, or when multiple signals add together to greater than 1.0.
NOW I am confused! If I am having more than one channel active, how do I adjust the gain so that they are all mixed at the same "gain" and don't exceed 1? I tried dividing 0.99 by the number of active channels but that does not sound right when I hear it as I change the number/mix of active channels. One channel at 0.99 sounds louder(?) and less muted than two at 0.45. How do I get any combination of active mixer lines to "sound" the same?
I want to take a single digital music signal, send it through various effects and filters, send all that into multiple mixers combining them all together and sending them to the same output. I do send the left and right signals down their own identical paths with identical filter, effect, and mixer settings.
Sorry if I am being an idiot and this should be obvious but I am just not getting it. Can someone explain this to me? Thanks much.