Main Archive Specials Wiki | FAQ Links Submit Forum

 Simple biquad filter from apple.comType : LPReferences : Posted by neolit123 at gmail dot comNotes : Simple Biquad LP filter from the AU tutorial at apple.comCode : //cutoff_slider range 20-20000hz //res_slider range -25/25db //srate - sample rate //init mX1 = 0; mX2 = 0; mY1 = 0; mY2 = 0; pi = 22/7; //coefficients cutoff = cutoff_slider; res = res_slider; cutoff = 2 * cutoff_slider / srate; res = pow(10, 0.05 * -res_slider); k = 0.5 * res * sin(pi * cutoff); c1 = 0.5 * (1 - k) / (1 + k); c2 = (0.5 + c1) * cos(pi * cutoff); c3 = (0.5 + c1 - c2) * 0.25; mA0 = 2 * c3; mA1 = 2 * 2 * c3; mA2 = 2 * c3; mB1 = 2 * -c2; mB2 = 2 * c1; //loop output = mA0*input + mA1*mX1 + mA2*mX2 - mB1*mY1 - mB2*mY2; mX2 = mX1; mX1 = input; mY2 = mY1; mY1 = output;

 CommentsAdded on : 05/03/09 by neolit123[ AT ]gmail[ DOT ]comComment : here are coefficients for the hp version. the br,bp & peak are also easy to calculate: k = 0.5*res*sin(pi*cutoff); c1 = 0.5*(1-k)/(1+k); c2 = (0.5+c1)*cos(pi*cutoff); c3 = (0.5+c1+c2)*0.25; a0 = 2*c3; a1 = -4*c3; a2 = 2*c3; b1 = -2*c2; b2 = 2*c1; if you wish to create a cascade, use the this: //----sample loop //mem: buffer array //N: number of biquads, n=4 -> 48dB/oct //set input here for (i=0;i>> insert here input = output; //>>> insert here ); //----sample loop =========================== lubomirAdded on : 25/01/11 by giku[ DOT ]itoa[ AT ]gmail[ DOT ]comComment : How to make bandpass from this?

 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