math shaper

A waveshaper object based on the division of two 4th-order polynomials, real radices only.
Author: Sputnki
License: BSD
Github: sptnk/math/math shaper.axo

Inlets

frac32buffer in

frac32 z0

frac32 z1

frac32 z2

frac32 z3

frac32 p0

frac32 p1

frac32 p2

frac32 p3

Outlets

frac32buffer out

Parameters

frac32.s.map z0

frac32.s.map z1

frac32.s.map z2

frac32.s.map z3

frac32.s.map p0

frac32.s.map p1

frac32.s.map p2

frac32.s.map p3

Attributes

spinner zeros

spinner poles

Declaration
int32_t coefs_z[4];
int32_t coefs_p[4];
int32_t n;
int32_t d;
Control Rate
coefs_z[0] = param_z0 + inlet_z0;
coefs_z[1] = param_z1 + inlet_z1;
coefs_z[2] = param_z2 + inlet_z2;
coefs_z[3] = param_z3 + inlet_z3;

coefs_p[0] = param_p0 + inlet_p0;
coefs_p[1] = param_p1 + inlet_p1;
coefs_p[2] = param_p2 + inlet_p2;
coefs_p[3] = param_p3 + inlet_p3;

for (int i = 0; i < BUFSIZE; i++) {
  n = 1 << 27;
  d = 1 << 27;
  for (int j = 0; j < attr_zeros; j++)
    n = ___SMMUL(inlet_in[i] - coefs_z[j] << 2, n << 3);
  for (int j = 0; j < attr_poles; j++)
    d = ___SMMUL(inlet_in[i] - coefs_p[j] << 2, d << 3);

  float temp = (float)n / d;
  temp *= 134217728.0f;
  outlet_out[i] = temp;
}

Privacy

© 2024 Zrna Research