mmhp

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

Inlets

frac32buffer input

frac32 cutoff frequency

Outlets

frac32buffer output

Parameters

frac32.u.map freq

int32.hradio 6,12,18,24db

bool32.tgl on

Declaration
int32_t valHP1;
int32_t valHP2;
int32_t valHP3;
int32_t valHP4;
Init
valHP1 = 0;
valHP2 = 0;
valHP3 = 0;
valHP4 = 0;
Control Rate
// HP //
int32_t fHP1;
MTOF(param_freq + inlet_freq, fHP1);

// HP //
int32_t fHP2;
MTOF(param_freq + inlet_freq, fHP2);

// HP //
int32_t fHP3;
MTOF(param_freq + inlet_freq, fHP3);

// HP //
int32_t fHP4;
MTOF(param_freq + inlet_freq, fHP4);
Audio Rate
// HP //
valHP1 = ___SMMLA((inlet_in - valHP1) << 1, fHP1, valHP1);
valHP2 = ___SMMLA((valHP1 - valHP2) << 1, fHP2, valHP2);
valHP3 = ___SMMLA((valHP2 - valHP3) << 1, fHP3, valHP3);
valHP4 = ___SMMLA((valHP3 - valHP4) << 1, fHP4, valHP4);

int32_t SWITCHOUT;
switch (param_db > 0 ? param_db : 0) {
case 0:
  SWITCHOUT = valHP1;
  break;
case 1:
  SWITCHOUT = valHP2;
  break; // LP is routed thorugh the HP //
case 2:
  SWITCHOUT = valHP3;
  break;
case 3:
  SWITCHOUT = valHP4;
  break;
}

outlet_out = (param_on) ? (inlet_in - SWITCHOUT) : inlet_in;

Privacy

© 2024 Zrna Research