ZZZ{ classvar 2.2), { voltage = 2.2.log + ampToVACConst; },{ voltage = amplitude.log + ampToVACConst; }); }); voltage.postln; ^voltage; } /** * Calculates amplitude for supplied voltage. * Linear until ampToVACConst. * Maximum amplitude output: 2.2 * @return amplitude needed to achieve the voltage supplied. */ *vacToAmp{ arg voltage; var amplitude; if((voltage <= ampToVACConst), { amplitude = voltage/ampToVACConst; },{ amplitude = (voltage-ampToVACConst).exp; if(amplitude > 2.2, { amplitude = 2.2; }); }); amplitude.postln; ^amplitude; } }