C-Weighed Filter

Type : digital implementation (after bilinear transform)
References : Posted by Christian@savioursofsoul.de
Notes :
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;


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;

from : Christian[AT]savioursofsoul[DOT]de
comment : 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.

from : kiranpatel0305[AT]gmail[DOT]com
comment : 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.