softClip

Soft limiter with input gain and positive/negative gain offset (gain-modulation by incoming audio)to create tube-like waveforms and other distortions (high mod settings)
Author: Remco van der Most
License: BSD
Github: sss/sss/softClip.axo

Inlets

frac32buffer i1

frac32 gain

Outlets

frac32buffer o1

Parameters

frac32.u.map gain

frac32.s.map mod

Declaration
int32_t v30 = 1 << 30;
int32_t v27 = 1 << 27;
int32_t prv;
int32_t stp;
Control Rate
int32_t gain = __USAT(param_gain + inlet_gain, 28);
stp = gain - prv >> 4;
int32_t Gain = prv;
prv = gain;
Audio Rate
int32_t mod = ___SMMUL(param_mod << 3, Gain << 2);
int32_t i1 = __SSAT(inlet_i1, 28);
int32_t val = __SSAT(___SMMUL(i1 << 1, Gain + ___SMMUL(i1 << 3, mod << 4)), 25)
              << 6;
val = __SSAT(val, 28);
int32_t ABS = val > 0 ? val : -val;
int32_t dir = val > 0 ? v27 : -v27;
outlet_o1 = val - (___SMMUL(ABS, val - dir) << 5);
Gain += stp;

Privacy

© 2024 Zrna Research