ConstantGainDistortion applies a distortion function of your choosing, and adjusts the output gain to match the input signal (by RMS).
Rationale: Distortion effects are usually volume-dependent, resulting in a wide output dynamic range. This complicates mixing in a live situation; as you increase the distortion preamp, you may need to reduce channel volume simultaneously. By matching output volume to the input, you get the spectral effect of the distortion without a large increase in volume.
It is not recommended to modulate preamp
very rapidly (because the RMS calculations need a little time to catch up). Slow modulation is fine.
The RMS quotient may introduce a small amount of amplitude modulation. Large rmsSize values will reduce the amount of amplitude modulation, but may affect envelope transients. Small rmsSize values may exhibit greater amplitude modulation.
Add the distortion UGens, at audio rate.
in |
Input signal. |
preamp |
Pre-distortion gain factor, as a simple multiplier (1.0 = 0 dB; 2.0 ~= +6 dB). |
distFunc |
A function, whose argument will receive |