Mixing and Panning multichannel signals often requires Level Compensation when Mixing and Panning. LevelComp provides a logic for this that is used internally in the Splay and SplayAz UGens. Using the levelComp
argument of Splay/Az
, it calculates a level compensation factor applied to the input signals, depending on the number of input channels.
Calculate a scaling factor based on the levelComp
argument and the number of channels to be mixed.
levelComp |
a flag or numeric value:
|
rate |
the rate for which to calculate - \audio or \control. |
n |
the number of channels being mixed and scaled. |
the levelComp factor by which to multiply the output signals.
Splay
and SplayAz
use LevelComp
internally via the levelComp
argument, and obtain rate and number of channels from Splay/Az
.
Here is an Overview of the levelComp
usage variants:
We begin testing with equal power compensation: how much too high can the summed levels rise for different numbers of channel to mix/pan with Splay?
Trying the same example with 20 channels and with equal power compensation, (which we get with levelComp true
), we see that the resulting sum levels are much higher:
Finally, here are the theoretical worst cases for 20, 200, and 2000 channels, with equal power: 13, 23 and 33 db louder!
So for maximum peak safety, use levelComp: 1
(or equivalently, set levelComp: false
, and explicitly set level to 1/n, i.e. divide by the number of channels for amplitude compensation).
Then the levels predictably remain the same, independent of the number of channels to be mixed.