ahd delayed

delayed attack hold decay envelope. Delay parameter determins a time of delay after rising gate until the envelope starts.
Author: Johannes Taelman (additions by Peter Witzel)
License: BSD
Github: cpwitz/env/ahd delayed.axo

Inlets

bool32.risingfalling gate

Outlets

frac32.positive env

Parameters

frac32.s.map.klineartime.exp delay

frac32.s.map.kdecaytime.exp a

frac32.s.map.kdecaytime.exp d

Declaration
int32_t val;
int32_t delay;
int32_t ntrig;
Init
val = 0;
delay = 0;
ntrig = 0;
Control Rate
if (inlet_gate > 0) {
  if (ntrig == 0) {
    ntrig = 1;
  } else {
    if (delay < (1 << 27)) {
      int32_t t;
      MTOF(-param_delay, t);
      delay += t >> 6;
      val = ___SMMUL(val, param_d) << 1;
    } else {
      val = (1 << 27) - (___SMMUL((1 << 27) - val, param_a) << 1);
    }
  }
} else {
  ntrig = 0;
  val = ___SMMUL(val, param_d) << 1;
  delay = 0;
}
outlet_env = val;

Privacy

© 2024 Zrna Research