# [music-dsp] Simple signal mixing algorithm

Harvey Holmes H.Holmes at unsw.edu.au
Wed Jul 20 20:27:19 EDT 2005

```The correct answer to the problem is to divide by n (the number of
channels) if all the channels have identical signals, as Ian writes.  This
is too large a factor in any other case.

A better initial stab at a reasonable solution in the music context is to
assume that the signals are random and statistically independent, in which
case they will add in _power_ , not voltage.  It follows that you should
divide by the square root of n in this case, not n.

This solution doesn't allow for the possible different peak-to-rms ratios
of different signals, so in practice some headroom is usually left (e.g. 6
- 12 dB) in fixed point solutions.

Incidentally, this topic has been extensively studied in the literature,
and any book on signal processing will usually have a chapter on finite
word length effects, including scaling (the problem being discussed here).

Harvey

Assuming tha

At 03:32 21/07/2005, Ian wrote:

>Right, dividing by the # of signals is only going to give you the "right
>answer" if all of the signals are the same volume _and_ in phase.
>
>Ian

```