[music-dsp] Polyphony - how do you mix N number of signals and keep a consistent volume?

robert bristow-johnson rbj at audioimagination.com
Sun Oct 24 20:26:25 EDT 2010

On Oct 24, 2010, at 5:23 PM, Alan Wolfe wrote:

> How I understand mixing is that if you have N signals, all in the
> range of -1,1 that you want to add all the signals together then
> divide by N to get an output signal still in the range of -1,1.
> What do you do then if you are making a live playing synthesizer and
> want to play 1 to N notes at the same time?
> If i cap the max number of notes to 8, add all the channels together
> (some of which may be silent) and then divide by 8, single notes
> played alone are very quiet.
> If i only divide by the number of non silent channels, there is an
> audible pop when a new note is added or removed and the rest of the
> audible channels suddenly increase or decrease in volume.

would you expect something different?

> How is this normally handled?

i dunno what this is, a synthesized organ or similar?

normally, whether you have 0 or 1 or 2 or N notes that may or may not  
have simultaneous onset or release, you do *no* scaling per se  
regarding the number of notes.  just add 'em together.  we assume that  
the note onset and release is click free by virtue of the synthesis or  
sample playback alg.

now, to keep a consistent volume, that is level compression or AGC.   
you apply that to the summed channel or channels (in case of stereo).   
the gain change applied by the compressor or AGC better be designed to  
be reasonably smooth, by use of some ramping or LPF on the gain  
control signal.  sometimes you cannot avoid some artifact of the gain  
change (usually called "pumping") but you should always be able to  
avoid clicking or popping.  clicks or pops are an indication that some  
mistake has happened.

that's my spin on it.


r b-j                  rbj at audioimagination.com

"Imagination is more important than knowledge."

More information about the music-dsp mailing list