Main Archive Specials Wiki | FAQ Links Submit Forum

 Resonant filterReferences : Posted by Paul KellettNotes : 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.Code : //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;

 CommentsAdded on : 18/01/06 by mr[ DOT ]just startingComment : very nice! how could i turn that into a HPF?Added on : 23/01/06 by dsp[ AT ]dsparsons[ DOT ]nospam[ DOT ]co[ DOT ]ukComment : The cheats way is to use HPF = sample - out; If you do a plot, you'll find that it isn't as good as designing an HPF from scratch, but it's good enuff for most ears. This would also mean that you have a quick method for splitting a signal and operating on the (in)discreet parts separately. :) DSPAdded on : 12/09/06 by scoofy[ AT ]inf[ DOT ]elte[ DOT ]huComment : This filter calculates bandpass and highpass outputs too during calculation, namely bandpass is buf0 - buf1 and highpass is in - buf0. So, we can rewrite the algorithm: // f and fb calculation f = 2.0*sin(pi*freq/samplerate); /* you can approximate this with f = 2.0*pi*freq/samplerate with tuning error towards nyquist */ fb = q + q/(1.0 - f); // loop hp = in - buf0; bp = buf0 - buf1; buf0 = buf0 + f * (hp + fb * bp); buf1 = buf1 + f * (buf0 - buf1); out = buf1; // lowpass out = bp; // bandpass out = hp; // highpass The slope of the highpass out is not constant, it varies between 6 and 12 dB/Octave with different f and q settings. I'd be interested if anyone derived a proper highpass output from this algorithm. -- peter schoffhauzer

 Add your own comment Comments are displayed in fixed width, no HTML code allowed! Email: Comment: Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion