cgate

(noise-)gate module to use with the chainFX effects chainer module. Opens audio when above treshold and ducks the audio again when below the "treshold minus offhysteris". Controls can easily be editted for external control
Author: Remco van der Most
License: BSD
Github: sss/fx/chainer/cgate.axo

Inlets

None

Outlets

None

Parameters

frac32.s.map decay

frac32.s.map attack

frac32.s.map release

frac32.u.map.gain sets threshold of gate. Click on number to select dB value

frac32.u.map.gain sets hysteresis for off-treshold calculated from on-treshold. (lowers the dB value in respect to on-treshold, the higher the value of the Offhyst is)

bool32.tgl bypass

bool32.tgl solo

Declaration
uint32_t v30 = (uint32_t)1 << 30;
uint32_t v26 = (uint32_t)1 << 26;
uint32_t v27 = (uint32_t)1 << 27;
int32_t outL;
int32_t outR;
int32_t decay;
int32_t valL;
int32_t valR;
int32_t onT;
int32_t offT;
bool gateL;
bool gateR;
int32_t GL;
int32_t GR;
int32_t AT;
int32_t DE;
bool bypass, solo;
int32_t FX(int32_t inL, int32_t inR, int32_t CV1, int32_t CV2) {
  int32_t IL = inL;
  int32_t IR = inR;
  inL = inL > 0 ? inL : -inL;
  inR = inR > 0 ? inR : -inR;
  if (inL > valL) {
    valL = inL;
  } else {
    valL += ___SMMUL(decay, inL - valL);
  }

  if (inR > valR) {
    valR = inR;
  } else {
    valR += ___SMMUL(decay, inR - valR);
  }

  if (gateL == 0) {
    gateL = valL > onT ? 1 : 0;
    GL += ___SMMUL(-GL, DE) >> 3;
  } else {
    gateL = valL < offT ? 0 : 1;
    GL += ___SMMUL(v27 - GL, AT) << 1;
  }

  if (gateR == 0) {
    gateR = valR > onT ? 1 : 0;
    GR += ___SMMUL(-GR, DE) >> 3;
  } else {
    gateR = valR < offT ? 0 : 1;
    GR += ___SMMUL(v27 - GR, AT) << 1;
  }

  outL = ___SMMUL(IL, GL) << 5;
  outR = ___SMMUL(IR, GR) << 5;

  if (bypass > 0) {
    outL = IL;
    outR = IR;
  }
};
Control Rate
bypass = param_bypass;
solo = param_solo;
MTOF(-param_decay, decay)

onT = param_OnTres >> 4;
offT = onT - (___SMMUL(onT, param_Offhyst) << 1);
MTOF(-param_attack, AT)
MTOF(-param_release, DE)

Privacy

© 2024 Zrna Research