2
\$\begingroup\$

I have a dozen of sources of digital signal, 16-bit signed words. I have implemented very simple mixer where all sample values are summed, and then shifted right to prevent overload. Unfortunately simplicity goes at a cost - if only one (or few) channels are coming into mixer at their full scale, their volume is at least 3 dB down; increasing number of input channels increases attenuation even more.

Is there any advanced (balanced?) way to have digital signal mixed?

\$\endgroup\$
  • \$\begingroup\$ Do you have a way to determine how many inputs are actually active? \$\endgroup\$ – JimmyB Jan 21 '17 at 13:10
  • \$\begingroup\$ For most of them - yes \$\endgroup\$ – Anonymous Jan 21 '17 at 17:36
3
\$\begingroup\$

Generally speaking, if your mixer has no input or output gain adjustments, the approach you're taking is correct, but conservative.

If the sound sources are uncorrelated, then the power and RMS voltage of the combined signal only goes up with the square root of the number of input signals. For example, if you have 16 inputs, you would only need to divide the sum by 4 to keep the output power about the same as a single input signal. This is a good compromise, assuming you're willing to accept the occasional peak getting clipped (use saturating arithmetic in your adding-up).

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

maybe you can implement a digital AGC: sum up the channels, calculate a ****long term**** average - this can be done via a simple exponential smoothing, and then based on that long-term average, adjust individual channels: if the long-term average is lower than a preset value, increase all channels (other than those full scale); vice versa.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.