ad_mod

Attack/decay envelope, linear attack, exponential decay with modulation
Author: Johannes Taelman (modified by workerparasite303)
License: BSD
Github: wp/env/ad_mod.axo

Inlets

bool32.rising trigger

frac32.bipolar attack time modulation

frac32.bipolar decay time modulation

Outlets

frac32.positive envelope output

Parameters

frac32.s.map.klineartime.exp a

frac32.s.map d

Declaration
int8_t stage;
int ntrig;
int32_t val;
Init
ntrig = 0;
val = 0;
Control Rate
if ((inlet_trig > 0) && !ntrig) {
  ntrig = 1;
  stage = 1;
} else if (!(inlet_trig > 0)) {
  ntrig = 0;
}
if (stage == 0) {
  val = ___SMMUL(val, param_d) << 1;
} else {
  int32_t t;
  MTOF(-param_a, t);
  val = val + (t >> 3);
  if (val < 0) {
    val = 0x7FFFFFFF;
    stage = 0;
  }
}
outlet_env = val >> 4;

Privacy

© 2024 Zrna Research