Hi all,
I'm trying to code a filter that does a true bypass in the "middle" position of a frequency knob, and does biquad LP or HP when leaving that position with increasing resonance. It seems to me that there is no setting for biquad_hp_coefs and biquad_lp_coefs that sound like no filter is active, is there? I always get some bass boost out the HP and some dip in the high frequencies with the LP, even in the lowest/highest frequency setting and with 0 resonance. If there was a neutral setting, I could just put the filters in series.
That's why I've decided to bypass the filters when they're not supposed to be active, but that gives me other problems.
Here's my Local Data:
biquad_state bs_lp;
biquad_state bs_hp;
biquad_coefficients bc;
And here's my K-rate code:
int32_t freq;
int32_t true_pitch;
int32_t dummy[BUFSIZE];
if (param_pitch > 0) {
// High Pass, resonance increases with increasing filter frequency
true_pitch = param_pitch*2 - (1<<27);
MTOF(true_pitch,freq);
biquad_hp_coefs(&bc,freq,INT_MAX - (param_pitch<<3));
biquad_dsp(&bs_hp,&bc,inlet_in,outlet_out);
MTOF(1<<27,freq);
biquad_lp_coefs(&bc,freq,INT_MAX);
biquad_dsp(&bs_lp,&bc,inlet_in,dummy);
} else if (param_pitch < 0) {
// Low Pass, Resonance increases with decreasing filter frequency
MTOF(-1<<27,freq);
biquad_hp_coefs(&bc,freq,INT_MAX);
biquad_dsp(&bs_hp,&bc,inlet_in,dummy);
true_pitch = param_pitch*2 + (1<<27);
MTOF(true_pitch + inlet_pitch,freq);
biquad_lp_coefs(&bc,freq,INT_MAX - (-param_pitch<<3));
biquad_dsp(&bs_lp,&bc,inlet_in,outlet_out);
} else {
// param_pitch == 0 --> Bypass
for (int i=0; i<BUFSIZE; i++) outlet_out[i] = inlet_in[i];
MTOF(1<<27,freq);
biquad_lp_coefs(&bc,freq,INT_MAX);
biquad_dsp(&bs_lp,&bc,inlet_in,dummy);
MTOF(-1<<27,freq);
biquad_hp_coefs(&bc,freq,INT_MAX);
biquad_dsp(&bs_hp,&bc,inlet_in,dummy);
}
I noticed that when the LP and HP share their state, there's an audible noise when sweeping from LP to HP. That's why I created separated states and update all of them in the most neutral frequency and resonance setting possible when they're not active, now the noise is almost gone. Do you think this is over the top somewhere?
Although the nasty noise is gone, there is still an audible click when going from bypass to highpass. How do I get rid of that?
What can I do? Thanks for any help!
Boris