AHD crv

mod of an object by remco van der most Attack/decay envelope, curved envelopes. anti-clockwise: exponential clockwise: inverse exponential
Author: Robert Schirmer
License: BSD
Github: rbrt/control/AHD crv.axo

Inlets

bool32.risingfalling gate

frac32.positive a

frac32.positive d

bool32.rising reset

Outlets

frac32.positive envelope output

bool32 state

Parameters

frac32.s.map curveA

frac32.s.map curveD

Declaration
int32_t val;
Init
val = 0;
Control Rate
int32_t crv1;
int32_t crv2;
crv1 = param_curveA;
crv2 = param_curveD;

int32_t t;
if (inlet_gate == 0) {
  MTOF(-((inlet_d - (1 << 26)) << 2) + ___SMMUL(val - (1 << 30), -crv2 << 2),
       t);
  val = __USAT(val - (t >> 3), 31);
} else {

  MTOF(-((inlet_a - (1 << 26)) << 2) + ___SMMUL(val - (1 << 30), -crv1 << 2),
       t);
  val = val + (t >> 3);
  if (val < 0) {
    val = 0x7FFFFFFF;
  }
}
if (inlet_reset)
  val = 0;
outlet_env = val >> 4;
outlet_state = (val > 0);

Privacy

© 2024 Zrna Research