mmlp

1st order LP filter, 6 to 24 db selector.
Author: Jaffasplaffa (Original by Johannes Taelman)
License: BSD
Github: jaffa/filt/mmlp.axo

Inlets

frac32buffer input

frac32 cutoff frequency

Outlets

frac32buffer output

Parameters

bool32.tgl on

frac32.u.map freq

int32.hradio 6,12,18,24db

Declaration
int32_t valLP1;
int32_t valLP2;
int32_t valLP3;
int32_t valLP4;
Init
valLP1 = 0;
valLP2 = 0;
valLP3 = 0;
valLP4 = 0;
Control Rate
// LP //
int32_t fLP1;
MTOF(param_freq + inlet_freq, fLP1);

// LP //
int32_t fLP2;
MTOF(param_freq + inlet_freq, fLP2);

// LP //
int32_t fLP3;
MTOF(param_freq + inlet_freq, fLP3);

// LP //
int32_t fLP4;
MTOF(param_freq + inlet_freq, fLP4);
Audio Rate
// LP //
valLP1 = ___SMMLA((inlet_in - valLP1) << 1, fLP1, valLP1);
valLP2 = ___SMMLA((valLP1 - valLP2) << 1, fLP2, valLP2);
valLP3 = ___SMMLA((valLP2 - valLP3) << 1, fLP3, valLP3);
valLP4 = ___SMMLA((valLP3 - valLP4) << 1, fLP4, valLP4);

int32_t SWITCHOUT;
switch (param_db > 0 ? param_db : 0) {
case 0:
  SWITCHOUT = valLP1;
  break;
case 1:
  SWITCHOUT = valLP2;
  break;
case 2:
  SWITCHOUT = valLP3;
  break;
case 3:
  SWITCHOUT = valLP4;
  break;
}

outlet_out = (param_on) ? SWITCHOUT : inlet_in;

Privacy

© 2024 Zrna Research