softshelf

"soft" distortion with inbuild tone-control
Author: Remco van der Most
License: BSD
Github: sss/dist/softshelf.axo

Inlets

frac32buffer audio input

Outlets

frac32buffer.bipolar audio output

Parameters

bool32.tgl absC

bool32.tgl absS

bool32.tgl absD

frac32.u.map.gain gain

frac32.s.map.pitch center

frac32.s.map modC

frac32.s.map shelf

frac32.s.map modS

Declaration
int32_t lp;
int32_t SOFT(int32_t in) {
  int32_t ts = __SSAT(in, 28);
  int32_t tsq31 = ts << 3;
  int32_t tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
  return ts = ts + (ts >> 1) - (tsq31p3);
}
Audio Rate
int32_t inD =
    SOFT(inlet_in + (___SMMUL(__SSAT(inlet_in, 28), param_gain) << 3));
int32_t inC = inlet_in;
inD -= inC;
int32_t frq;
int32_t tmp = inC;
if (param_absC > 0) {
  tmp = tmp > 0 ? tmp : -tmp;
}
MTOF(param_center + (___SMMUL(param_modC, tmp) << 5), frq)
lp = ___SMMLA(inD - lp << 1, frq, lp);
int32_t inL = inD - (lp << 1);
if (param_absS > 0) {
  inL = inL > 0 ? inL : -inL;
}

outlet_out =
    SOFT(inC + inD +
         (___SMMUL(param_shelf + (___SMMUL(param_modS, inC) << 5), inL) << 5));

Privacy

© 2024 Zrna Research