asymSin

Asymmetrical sine-shaper Important: set mod-knob to 64 for no shaping. Mod knob can be seen as a treshold knob, lowering the value will lower the point the signal will go into sineshape. From 64 to 0 it lowers the "treshold" down to zero. When below zero, it amplifies the incoming signal, widening the phase-modulation of the sines for more overtones.
Author: Remco van der Msot
License: BSD
Github: sss/math/asymSin.axo

Inlets

frac32 mod1

frac32 mod2

frac32buffer in

Outlets

frac32buffer out

Parameters

frac32.s.map mod1

frac32.s.map mod2

Declaration
int32_t O1;
Init
SINE2TINTERP(1 << 30, O1)
Control Rate
int32_t mod1 = param_mod1 + inlet_mod1;
int32_t mod2 = mod1 < 0 ? -mod1 : 0;
mod1 = mod1 > 0 ? mod1 : 0;
int32_t mod3 = param_mod2 + inlet_mod2;
int32_t mod4 = mod3 < 0 ? -mod3 : 0;
mod3 = mod3 > 0 ? mod3 : 0;
Audio Rate
int32_t in = inlet_in;
if (in > 0) {
  in += ___SMMUL(mod2 << 4, in << 4);
} else {
  in += ___SMMUL(mod4 << 4, in << 4);
}
int32_t clip = in > mod1 ? mod1 : in;
clip = clip < -mod3 ? -mod3 : clip;
int32_t over = in - clip;
if (over > 0) {
  SINE2TINTERP((-over << 4) + (1 << 30), over)
  over = over >> 5;
  over -= (O1 >> 5);
} else {
  SINE2TINTERP((-over << 4) - (1 << 30), over)
  over = over >> 5;
  over += (O1 >> 5);
}
outlet_out = clip + (over);

Privacy

© 2024 Zrna Research