//This on is strange.
//
//Cascaded resonant lowpass/hipass combi-filter
//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.

desc: (Can be loud !) Read info...

slider1:0<0,1,0.01>lopass
slider2:0<0,1,0.01>hipass
slider3:0<0,1,0.01>res lopass
slider4:0<0,1,0.01>res hipass

@init
n1=0;
n2=0;
n3=0;
n4=0;

fb_lp=0;
fb_hp=0;

@slider
cut_lp=slider1;
cut_hp=slider2;
res_lp=slider3;
res_hp=slider4;

@sample
inp=(spl0+spl1)*0.5;

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);

spl0=spl0-n4;
spl1=spl1-n4;

