dualBezShapeV2

dual bezier curve shaper. One for position, the other for level. This version has "rate" added to the modulation options. With these you set the vector-rates at each point.
Author: Remco van der Most
License: BSD
Github: sss/shape/dualBezShapeV2.axo

Inlets

frac32buffer.positive Phase Input

frac32 width

frac32 Parameter 1a

frac32 Parameter 1b

frac32 Parameter 1c

frac32 Parameter 2a

frac32 Parameter 2b

frac32 Parameter 2c

frac32 rateP0

frac32 rateP1

frac32 rateP2

frac32 rateA0

frac32 rateA1

frac32 rateA2

Outlets

frac32buffer output

frac32buffer phase

Parameters

int32 hrm1

int32 hrm2

int32 hrmR

Declaration
int32_t prev;
Control Rate
int32_t step = (inlet_width - prev) >> 4;
int32_t width = prev;
prev = inlet_width;
Audio Rate
{
  int32_t P1 = inlet_phase;
  P1 = (P1 * param_hrm1) & ((1 << 27) - 1);
  int32_t P2 = inlet_phase;
  P2 = (P2 * param_hrm2) & ((1 << 27) - 1);
  width += step;
  int32_t I0 = ___SMMUL(width << 3, inlet_pos0 << 2);
  int32_t I1 = ___SMMUL(width << 3, inlet_pos1 << 2);
  int32_t I2 = ___SMMUL(width << 3, inlet_pos2 << 2);
  int32_t J0 = ___SMMUL(width << 3, inlet_ampl0 << 2);
  int32_t J1 = ___SMMUL(width << 3, inlet_ampl1 << 2);
  int32_t J2 = ___SMMUL(width << 3, inlet_ampl2 << 2);
  int32_t Ri0 = ___SMMUL(width << 3, inlet_rateP0 << 2);
  int32_t Ri1 = ___SMMUL(width << 3, inlet_rateP1 << 2);
  int32_t Ri2 = ___SMMUL(width << 3, inlet_rateP2 << 2);
  int32_t Rj0 = ___SMMUL(width << 3, inlet_rateA0 << 2);
  int32_t Rj1 = ___SMMUL(width << 3, inlet_rateA1 << 2);
  int32_t Rj2 = ___SMMUL(width << 3, inlet_rateA2 << 2);

  int(x1) = P1;
  int(y1) = ((128 << 20) - P1);
  int p0 = (int64_t)I0 + ___SMMUL(Ri0 << 2, P1 << 2);
  int p1 = (int64_t)I1 + ___SMMUL(Ri1 << 2, P1 << 2);
  int p2 = (int64_t)I2 + ___SMMUL(Ri2 << 2, P1 << 2);
  int p3 = (int64_t)I0 - I1 + ___SMMUL(Ri0 + Ri1 << 2, P1 - (1 << 27) << 2);
  int p4 = (int64_t)I0 + ___SMMUL(Ri0 << 2, P1 - (1 << 27) << 2);

  int x2 = ___SMMUL(x1 << 3, x1 << 2);
  int x3 = ___SMMUL(x2 << 3, x1 << 2);
  int x4 = ___SMMUL(x3 << 3, x1 << 2);
  int y2 = ___SMMUL(y1 << 3, y1 << 2);
  int y3 = ___SMMUL(y2 << 3, y1 << 2);
  int y4 = ___SMMUL(y3 << 3, y1 << 2);

  int a = ___SMMUL(y4 << 3, p0 << 3);
  int b = ___SMMUL(x1 << 4, ___SMMUL(y3 << 3, p1 << 3) << 1) * 4;
  int c = ___SMMUL(x2 << 4, ___SMMUL(y2 << 3, p2 << 3) << 1) * 6;
  int d = ___SMMUL(x3 << 4, ___SMMUL(y1 << 3, p3 << 3) << 1) * 4;
  int e = ___SMMUL(x4 << 3, p4 << 3);
  int f = (inlet_phase + a + b + c + d + e) & ((1 << 27) - 1);

  f = (f * param_hrm2) & ((1 << 27) - 1);
  int(r1) = f;
  int(t1) = ((128 << 20) - f);
  int q0 = (int64_t)J0 + ___SMMUL(Rj0 << 2, f << 2);
  int q1 = (int64_t)J1 + ___SMMUL(Rj1 << 2, f << 2);
  int q2 = (int64_t)J2 + ___SMMUL(Rj2 << 2, f << 2);
  int q3 = (int64_t)J0 - J1 + ___SMMUL(Rj0 + Rj1 << 2, f - (1 << 27) << 2);
  int q4 = (int64_t)J0 + ___SMMUL(Rj0 << 2, f - (1 << 27) << 2);

  int r2 = ___SMMUL(r1 << 3, r1 << 2);
  int r3 = ___SMMUL(r2 << 3, r1 << 2);
  int r4 = ___SMMUL(r3 << 3, r1 << 2);
  int t2 = ___SMMUL(t1 << 3, t1 << 2);
  int t3 = ___SMMUL(t2 << 3, t1 << 2);
  int t4 = ___SMMUL(t3 << 3, t1 << 2);

  int g = ___SMMUL(t4 << 3, q0 << 2);
  int h = ___SMMUL(r1 << 4, ___SMMUL(t3 << 3, q1 << 3) << 1) * 4;
  int i = ___SMMUL(r2 << 4, ___SMMUL(t2 << 3, q2 << 3) << 1) * 6;
  int j = ___SMMUL(r3 << 4, ___SMMUL(t1 << 3, q3 << 3) << 1) * 4;
  int k = ___SMMUL(r4 << 3, q4 << 2);
  int l = (inlet_phase * param_hrmR + g + h + i + j + k) & ((1 << 27) - 1);
  int32_t r;
  SINE2TINTERP(l << 5, r)

  outlet_o = (r >> 6);
  outlet_phase = l;
}

Privacy

© 2024 Zrna Research