u2u

A unipolar k rate function defined by 2 segments.
Author: Smashed Transistors
License: LGPL
Github: tiar/kfunc/u2u.axo

Inlets

frac32 in

Outlets

frac32 out

Parameters

frac32.u.map p0

frac32.u.map p1

frac32.u.map p2

Control Rate
if (inlet_in >= (1 << 27))
  outlet_out = param_p2;
else if (inlet_in <= 0)
  outlet_out = param_p0;
else {
  int32_t i = inlet_in >> (27 - 1);               // i [0 2[
  int32_t a = (inlet_in & ((1 << (27 - 1)) - 1)); // a q26
  if (i < 1) { // [0 1[             q27         q26   q21           q27
    outlet_out = ___SMMLA(param_p1 - param_p0, a, param_p0 >> 6) << 6;
  } else { // [1 2[
    outlet_out = ___SMMLA(param_p2 - param_p1, a, param_p1 >> 6) << 6;
  }
}

Privacy

© 2024 Zrna Research