morphModeFilter

morphable LP<->BP<->HP filter with resonance and cutoff spread between LP and HP settings(BW). Using 4 standard filters which are morphed from LP to HP one by one using the "mode" parameter. This enables lots of different filter types from 1 knob: -24dB LP -6dB HP & 18dB LP (Bandpass filter) -12dB HP & 12dB LP (Bandpass filter) -18dB HP & 6dB LP (Bandpass filter) -24dB HP -and every single position in-between Center position is bandpass, lowest position (negative) is lowpass and highest position (positive) is highpass. Resonance works in all modes, though only the LP filter has self oscillation.
Author: Remco van der Most
License: BSD
Github: sss/filter/morphModeFilter.axo

Inlets

frac32buffer in2

frac32 cutoff

frac32 res

frac32 mode

Outlets

frac32buffer out

Parameters

frac32.s.map cutoff

frac32.s.map mode

frac32.u.map res

frac32.u.map BW

Declaration
int32_t val1;
int32_t val2;
int32_t val3;
int32_t val4;
int32_t val5;
int32_t val6;
int32_t valres;
int32_t valsat;
int32_t threshC;
Init
val1 = 0;
val2 = 0;
val3 = 0;
val4 = 0;
val5 = 0;
val6 = 0;
threshC = ((1 << 26) + (1 << 25));
Control Rate
int32_t mode = ((param_mode + inlet_mode) >> 1) + (1 << 26);

int32_t filterA = mode > 0 ? mode : 0;
filterA = filterA > (1 << 25) ? (1 << 25) : filterA;
int32_t filterB = mode > (1 << 25) ? mode - (1 << 25) : 0;
filterB = filterB > (1 << 25) ? (1 << 25) : filterB;
int32_t filterC = mode > (1 << 26) ? mode - (1 << 26) : 0;
filterC = filterC > (1 << 25) ? (1 << 25) : filterC;
int32_t filterD = mode > threshC ? mode - threshC : 0;
filterD = filterD > (1 << 25) ? (1 << 25) : filterD;

int32_t BW = param_BW;
int32_t f;
MTOF((param_cutoff + inlet_cutoff - ___SMMUL(filterA << 3, BW << 2)), f);
int32_t g;
MTOF((param_cutoff + inlet_cutoff - ___SMMUL(filterB << 3, BW << 2)), g);
int32_t h;
MTOF((param_cutoff + inlet_cutoff - ___SMMUL(filterC << 3, BW << 2)), h);
int32_t i;
MTOF((param_cutoff + inlet_cutoff - ___SMMUL(filterD << 3, BW << 2)), i);
int32_t j;
MTOF(param_cutoff + inlet_cutoff - 12, j);
int32_t k;
MTOF(param_cutoff + inlet_cutoff + 12, k);
Audio Rate
valsat = ___SMMUL((inlet_in - val6) << 4, (param_res + inlet_res) << 3);

int32_t ts = __SSAT(valsat, 28);
int32_t tsq31 = ts << 3;
int32_t tsq31p3 = ___SMMUL(tsq31, ___SMMUL(tsq31, tsq31));
valres = ts + (ts >> 1) - (tsq31p3);

val1 = ___SMMLA(((inlet_in + valres) - val1) << 1, f, val1);
int32_t Val1 = -val1 + ___SMMUL(filterA << 5, inlet_in << 2);
val2 = ___SMMLA((Val1 - val2) << 1, g, val2);
int32_t Val2 = -val2 + ___SMMUL(filterB << 5, Val1 << 2);
val3 = ___SMMLA((Val2 - val3) << 1, h, val3);
int32_t Val3 = -val3 + ___SMMUL(filterC << 5, Val2 << 2);
val4 = ___SMMLA((Val3 - val4) << 1, i, val4);
int32_t Val4 = -val4 + ___SMMUL(filterD << 5, Val3 << 2);
outlet_out = Val4;

val5 = Val4 - ___SMMLA(((Val4)-val5) << 1, j, val5);
val6 = ___SMMLA(((val5)-val6) << 1, k, val6);

Privacy

© 2024 Zrna Research