3xbiquad

2-pole resonant band-pass filter (biquad)
Author: Johannes Taelman
License: BSD
Github: sss/filter/3xbiquad.axo

Inlets

frac32buffer filter input

frac32 pitch

frac32 filter resonance

frac32 gain1

frac32 pitch2

frac32 reso2

frac32 gain2

frac32 pitch3

frac32 reso3

frac32 gain3

Outlets

frac32buffer filter output

Parameters

frac32.s.map.pitch pitch1

frac32.s.map.pitch pitch2

frac32.s.map.pitch pitch3

frac32.u.map.filterq reso1

frac32.u.map.filterq reso2

frac32.u.map.filterq reso3

frac32.u.map gain1

frac32.u.map gain2

frac32.u.map gain3

Declaration
biquad_state bs1;
biquad_coefficients bc1;
biquad_state bs2;
biquad_coefficients bc2;
biquad_state bs3;
biquad_coefficients bc3;
int32_t tmp[BUFSIZE];
int i;
Init
biquad_clearstate(&bs1);
biquad_clearstate(&bs2);
biquad_clearstate(&bs3);
Control Rate
int32_t freq1;
MTOF(param_pitch1, freq1);
freq1 += inlet_pitch1;
int32_t freq2;
MTOF(param_pitch2, freq2);
freq2 += inlet_pitch2;
int32_t freq3;
MTOF(param_pitch3, freq3);
freq3 += inlet_pitch3;
int32_t gain1 = param_gain1 + inlet_gain1;
int32_t gain2 = param_gain2 + inlet_gain2;
int32_t gain3 = param_gain3 + inlet_gain3;

biquad_bp_coefs(&bc1, freq1,
                INT_MAX - (__USAT(inlet_reso1 + param_reso1, 27) << 4));
biquad_dsp(&bs1, &bc1, inlet_in, outlet_out);
for (i = 0; i < BUFSIZE; i++) {
  tmp[i] = ___SMMUL(outlet_out[i] << 2, gain1 << 3);
}
biquad_bp_coefs(&bc2, freq2,
                INT_MAX - (__USAT(inlet_reso2 + param_reso2, 27) << 4));
biquad_dsp(&bs2, &bc2, inlet_in, outlet_out);
for (i = 0; i < BUFSIZE; i++) {
  tmp[i] += ___SMMUL(outlet_out[i] << 2, gain2 << 3);
}
biquad_bp_coefs(&bc3, freq3,
                INT_MAX - (__USAT(inlet_reso3 + param_reso3, 27) << 4));
biquad_dsp(&bs3, &bc3, inlet_in, outlet_out);
for (i = 0; i < BUFSIZE; i++) {
  outlet_out[i] = ___SMMUL(outlet_out[i] << 2, gain3 << 3);
  outlet_out[i] += tmp[i];
}

Privacy

© 2024 Zrna Research