d2 lin

decay envelope, linear rampwith modulation inputs and build in vca. "On" button turn envelope on. When "off" input is passed through with no gate.
Author: Jaffasplaffa
License: BSD
Github: jaffa/env/d2 lin.axo

Inlets

frac32buffer i

bool32.rising trigger

frac32.bipolar decay time

Outlets

frac32buffer o

Parameters

bool32.tgl on

frac32.s.map d

Displays

bool32 on

Declaration
int32_t prev;
int32_t step;

int32_t val;
int ntrig;
int32_t Loopval;
Init
val = 0;
ntrig = 0;
Control Rate
disp_on = 0;

// display gate
if (param_on) {
  disp_on = inlet_t;
}
// vca
step = (Loopval - prev) >> 4;
int32_t i = prev;
prev = Loopval;

// env
if ((inlet_t > 0) && !ntrig) {
  val = 1 << 27;
  ntrig = 1;
} else {
  if (!(inlet_t > 0))
    ntrig = 0;
  int32_t t;
  int32_t dt = param_d + inlet_d;
  MTOF(-dt, t);
  val -= t >> 6;
  if (val < 0)
    val = 0;
}
Loopval = val;
Audio Rate
// Env off
outlet_o = inlet_i;

// Env on
if (param_on) {

  outlet_o = ___SMMUL(inlet_i, i) << 5;
  i += step;
}

Privacy

© 2024 Zrna Research