Main Archive Specials Wiki | FAQ Links Submit Forum


Cascaded resonant lp/hp filter

Type : lp+hp
References : Posted by tobybear[AT]web[DOT]de

Notes :
// Cascaded resonant lowpass/hipass combi-filter
// The original source for this filter is from Paul Kellet from
// the archive. This is a cascaded version in Delphi where the
// output of the lowpass is fed into the highpass filter.
// Cutoff frequencies are in the range of 0<=x<1 which maps to
// 0..nyquist frequency

// input variables are:
// cut_lp: cutoff frequency of the lowpass (0..1)
// cut_hp: cutoff frequency of the hipass (0..1)
// res_lp: resonance of the lowpass (0..1)
// res_hp: resonance of the hipass (0..1)


Code :
var n1,n2,n3,n4:single; // filter delay, init these with 0!
fb_lp,fb_hp:single; // storage for calculated feedback
const p4=1.0e-24; // Pentium 4 denormal problem elimination

function dofilter(inp,cut_lp,res_lp,cut_hp,res_hp:single):single;
begin
fb_lp:=res_lp+res_lp/(1-cut_lp);
fb_hp:=res_hp+res_hp/(1-cut_lp);
n1:=n1+cut_lp*(inp-n1+fb_lp*(n1-n2))+p4;
n2:=n2+cut_lp*(n1-n2);
n3:=n3+cut_hp*(n2-n3+fb_hp*(n3-n4))+p4;
n4:=n4+cut_hp*(n3-n4);
result:=i-n4;
end;



Comments


Added on : 13/07/03 by office[ AT ]hermannseib[ DOT ]com
Comment :
I guess the last line should read
  result:=inp-n4;

Right?

Bye,

  Hermann




Added on : 26/12/03 by couriervst[ AT ]hotmail[ DOT ]com
Comment :
excuse me which type is? 6db/oct or 12 or what?

thanks




Added on : 02/02/04 by christianalthaus[ AT ]gmx[ DOT ]de
Comment :
result := n2-n4

:)




Added on : 25/01/11 by voss[ AT ]alinear[ DOT ]net
Comment :
WOW this is old but handy. Anyway what to do about the divide-by-zero caused by the feedback calc if the cutoff is set to 1.0?

Also, should the feedback for the hpf be:

fb_hp:=res_hp+res_hp/(1-cut_hp);

not:

fb_hp:=res_hp+res_hp/(1-cut_lp);

?

Thanks
NV




Added on : 17/03/17 by Gsound[ AT ]gmail[ DOT ]com
Comment :

Nobody can see ?

There is two lowpass filters in series, no differences between them.




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