expLPG

"voltage controlled lowpass-gate (LPG)", multiplies v and a inputs, with lowpass filter smoothing from k- to s-rate. This makes envelopes a bit more dampened then with linear interpolation. both the VCA-level and lowpass-frequency have curve-controls. Counter-clockwise is exponential curve, clockwise is inverse-exponential curve.
Author: Remco van der Most
License: BSD
Github: sss/gain/expLPG.axo

Inlets

frac32buffer a

frac32 gain input

frac32 expVCA

frac32 expLPG

frac32 cutoff

Outlets

frac32buffer output

Parameters

frac32.s.map expVCA

frac32.s.map expLPG

frac32.u.map cutoff

Declaration
int32_t step1;
int32_t step2;
int32_t step3;
int32_t level;
int32_t LP;
int32_t EXPO;
int inv;
int32_t expo(int32_t value, int32_t expa) {
  if (expa < 0) {
    value = (1 << 27) - value;
    expa = -expa;
    inv = 1;
  } else {
    inv = 0;
  }
  int32_t comp = (1 << 27) - expa;
  EXPO = ___SMMUL(value << 3, (comp + ___SMMUL(expa << 3, value << 2)) << 2);
  EXPO = ___SMMUL(EXPO << 3, (comp + ___SMMUL(expa << 3, EXPO << 2)) << 2);
  EXPO = ___SMMUL(EXPO << 3, (comp + ___SMMUL(expa << 3, EXPO << 2)) << 2);
  EXPO = ___SMMUL(EXPO << 3, (comp + ___SMMUL(expa << 3, EXPO << 2)) << 2);
  EXPO = ___SMMUL(EXPO << 3, (comp + ___SMMUL(expa << 3, EXPO << 2)) << 2);
  if (inv == 1) {
    EXPO = (1 << 27) - EXPO;
  }
}
Control Rate
expo(inlet_env, -__SSAT(param_expVCA + inlet_expVCA, 27));
int32_t varA = EXPO;
level = __USAT(inlet_cutoff + param_cutoff, 27);
expo(inlet_env, -__SSAT(param_expLPG + inlet_expLPG, 27));
int32_t varB = ___SMMUL(EXPO << 3, level << 3) - (1 << 27);
Audio Rate
step1 = step1 + ((varA - step1) >> 6);
step2 = step2 + ((varB - step2) >> 6);
int32_t freq;
MTOF((step2), freq)
int32_t o = ___SMMUL(inlet_a << 3, step1 << 3);
LP = __SMMLA((o - LP) << 1, freq, LP);
outlet_o = LP;

Privacy

© 2024 Zrna Research