bppBIQ

3x 2-pole resonant filters (biquad) 1 LP and 1 HP to create a band-width-controllable BP filter and a 3rd filter in BP mode which is added as an extra peak inside the set band ("center" cutoff range is normalised to bandwidth of LP and HP filters). Uses "object oriënted" coding, allowing the user to easily create his own filter. If you want to add more filters, don't forget to add buffers for each extra filter: as shown in local data-> int32_t tmp1[BUFSIZE] for the first filter)
Author: Remco van der Most
License: BSD
Github: sss/filter/bppBIQ.axo

Inlets

frac32buffer filter input

frac32 pitch

frac32 filter resonance

frac32 center

frac32 width

Outlets

frac32buffer filter output

Parameters

frac32.u.map.filterq resoHP

frac32.u.map.filterq resoLP

frac32.u.map.filterq resoC

frac32.u.map.gain peak

frac32.s.map.pitch cutoff

frac32.s.map center

frac32.u.map width

Declaration
biquad_state bs[3];
biquad_coefficients bc[3];
int32_t tmp1[BUFSIZE];
int32_t tmp2[BUFSIZE];
int32_t tmp3[BUFSIZE];
int i;
Init
for (i = 0; i < 3; i++) {
  biquad_clearstate(&bs[i]);
}
Control Rate
int32_t freq;
int32_t width = __SSAT(inlet_width + param_width, 28);
MTOF(param_cutoff + inlet_pitch +
         ___SMMUL(param_center + inlet_center << 2, width << 3),
     freq);
biquad_bp_coefs(&bc[0], freq,
                INT_MAX - (__USAT(inlet_reso + param_resoC, 27) << 4));
biquad_dsp(&bs[0], &bc[0], inlet_in, tmp1);

for (i = 0; i < BUFSIZE; i++) {
  tmp1[i] = __SSAT(inlet_in[i], 28) +
            (___SMMUL(__SSAT(tmp1[i], 28), param_peak) << 2);
}

MTOF(param_cutoff - width + inlet_pitch, freq);
biquad_hp_coefs(&bc[1], freq,
                INT_MAX - (__USAT(inlet_reso + param_resoHP, 27) << 4));
biquad_dsp(&bs[1], &bc[1], tmp1, tmp2);

MTOF(param_cutoff + width + inlet_pitch, freq);
biquad_lp_coefs(&bc[2], freq,
                INT_MAX - (__USAT(inlet_reso + param_resoLP, 27) << 4));
biquad_dsp(&bs[2], &bc[2], tmp2, outlet_out);

Privacy

© 2024 Zrna Research