fold

Wave folder distortion. Differentiated Anti aliasing.
Author: Smashed Transistors
License: LGPL
Github: tiar/dist/fold.axo

Inlets

frac32buffer.bipolar in

Outlets

frac32buffer out

Parameters

frac32.u.map gain

Declaration
float x0, x1, y0, y1;
Init
x0 = y0 = 0;
Audio Rate
x1 = x0;
y1 = y0;
x0 = arm::q_to_float(___SMMUL(inlet_in, param_gain), 27 - 5 - 3);
float f0 = x0 + 16.5f;
int32_t i0 = (int32_t)f0;
if (i0 & 1) {
  f0 = 2 * (f0 - i0) - 1.0f;
  y0 = 0.25f * (f0 * f0 - 1);
} else {
  f0 = -2 * (f0 - i0) + 1.0f;
  y0 = -0.25f * (f0 * f0 - 1);
}
float x1_x0 = x1 - x0;
if (fabs(x1_x0) > 0.001f) {
  outlet_out = arm::float_to_q((y1 - y0) / (x1_x0), 27);
} else {
  outlet_out = arm::float_to_q(f0, 27);
}

Privacy

© 2024 Zrna Research