Main Archive Specials Wiki | FAQ Links Submit Forum

 C-Weighed FilterType : digital implementation (after bilinear transform)References : Posted by Christian@savioursofsoul.deNotes : unoptimized version!Code : First prewarp the frequency of both poles: K1 = tan(0.5*Pi*20.6 / SampleRate) // for 20.6Hz K2 = tan(0.5*Pi*12200 / SampleRate) // for 12200Hz Then calculate the both biquads: b0 = 1 b1 = 0 b2 =-1 a0 = ((K1+1)*(K1+1)*(K2+1)*(K2+1)); a1 =-4*(K1*K1*K2*K2+K1*K1*K2+K1*K2*K2-K1-K2-1)*t; a2 =- ((K1-1)*(K1-1)*(K2-1)*(K2-1))*t; and: b3 = 1 b4 = 0 b5 =-1 a3 = ((K1+1)*(K1+1)*(K2+1)*(K2+1)); a4 =-4*(K1*K1*K2*K2+K1*K1*K2+K1*K2*K2-K1-K2-1)*t; a5 =- ((K1-1)*(K1-1)*(K2-1)*(K2-1))*t; Now use an equation for calculating the biquads like this: Stage1 = b0*Input + State0; State0 = + a1/a0*Stage1 + State1; State1 = b2*Input + a2/a0*Stage1; Output = b3*Stage1 + State2; State2 = + a4/a3*Output + State2; State3 = b5*Stage1 + a5/a3*Output;

 CommentsAdded on : 12/07/06 by Christian[ AT ]savioursofsoul[ DOT ]deComment : You might still need to normalize the filter output. You can do this easily by multipliing either the b0 and b2 or the b3 and b5 with a constant. Typically the filter is normalized to have a gain of 0dB at 1kHz Also oversampling of this filter might be useful.Added on : 18/09/11 by kiranpatel0305[ AT ]gmail[ DOT ]comComment :               Can anyone help me with C++ class composition to implement a single pole-filter design program. The program will allow the user to specify resistor and capacitor values and filter type. Once all the user parameters are specified, the program will return the cutoff frequency values for the filter. I need this as soon as possible and I am lost big time :( Create a Multifile Project for the Composition Lab 1. Add three classes to the project: a Filter class, a Capacitor class, and a Resistor class. 2. The Capacitor class should be modeled after the Resistor class for class members and operation.

 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