Skip to main content

unison_gains

Function unison_gains 

Source
pub fn unison_gains(voices: u8, blend: f64) -> UnisonGains
Expand description

The level compensation of unison voices at blend (stored 0 to 1).

Up to 2 voices the centre has gain 1 and the rest 0. Above that the centre is lerp(1, 0.4, blend) and each detuned voice lerp(0.6, 0, (1 - blend)^2), both scaled so that centre^2 + detuned^2 * (pairs - 1) = 1, with pairs the count ceil(voices / 2). A gain belongs to a pair of voices, which share it equally; the centre gain goes to the centre voice of an odd count, or to the innermost pair of an even one. Renders on the open engine confirm this for 3, 4, 5 and 8 voices within 0.001 of the single-voice amplitude.