- Author or source: Paul Kellett
- Created: 2002-01-17 02:07:02
This filter consists of two first order low-pass filters in series, with some of the difference between the two filter outputs fed back to give a resonant peak. You can use more filter stages for a steeper cutoff but the stability criteria get more complicated if the extra stages are within the feedback loop.
1 2 3 4 5 6 7
//set feedback amount given f and q between 0 and 1 fb = q + q/(1.0 - f); //for each sample... buf0 = buf0 + f * (in - buf0 + fb * (buf0 - buf1)); buf1 = buf1 + f * (buf0 - buf1); out = buf1;