DP type IIB

type IIB distortion by Differentiated Rational Function Anti aliasing.
Author: Smashed Transistors
License: BSD
Github: tiar/dist/DP type IIB.axo

Inlets

frac32 factor

frac32 offset

frac32buffer.bipolar in

Outlets

frac32buffer out

Parameters

frac32.s.map offset

frac32.u.map factor

Declaration
float x0, v0, x1, y0, y1;
Init
v0 = 0;
Control Rate
float factor = __USAT(param_factor + inlet_factor, 27) * (6.0f / (1 << 27));
float offset = __SSAT(param_offset + inlet_offset, 28) * (1.5f / (1 << 27));

// update according to new values
x0 = factor * (offset + v0);
y0 = x0 * x0 * x0 * x0 / (1 + x0 * x0 * x0 * x0);

// Integ x^-2 dx = -x^-1 = -1/x

for (int i = 0; i < BUFSIZE; i++) {
  x1 = x0;
  y1 = y0;
  x0 = factor * (offset + (v0 = arm::q_to_float(__SSAT(inlet_in[i], 28), 27)));
  float dx = x1 - x0;
  if (fabs(dx) > 0.005f) {
    y0 = x0 * x0 * x0 * x0 / (1 + x0 * x0 * x0 * x0);
    float dy = y1 - y0;
    outlet_out[i] = arm::float_to_q((3.6f / 4) * dy / dx, 27);
  } else {
    float inv = 1 / (1 + x0 * x0 * x0 * x0);
    y0 = x0 * x0 * x0 * x0 * inv;
    outlet_out[i] = arm::float_to_q(3.6f * x0 * x0 * x0 * inv * inv, 27);
  }
}

Privacy

© 2024 Zrna Research