d1

decay envelope with 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/d1.axo

Inlets

bool32.rising trigger

frac32 decay time

frac32buffer i

Outlets

frac32buffer o

Parameters

bool32.tgl on

frac32.s.map d

Declaration
int32_t prev;
int32_t step;

int32_t val;
int ntrig;
int32_t Loopval;
Init
val = 0;
ntrig = 0;
Control Rate
// 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 in = -inlet_d - param_d;
  int32_t c;
  MTOFEXTENDED(in, c);
  c = 0x7FFFFFFF - (c >> 2);
  val = ___SMMUL(val, c) << 1;
}
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