//The description says don't go above a frequency of srate/4. (slider3)
//Same as lowpass_resonant_5 but the resonance is in dB.
//Had to lower the max frequency to prevent dB overload.
//Controlling the res with dB brings also more fluctuation to the signal.

desc: Mono   Read info...

slider1:7347<20,9348,1>freq (Hz)
slider2:0<0,24,0.1>res (dB)
slider3:0,maxfreq (read only)

@init
pi=22/7;
pos = 0;
speed = 0;

@slider
amp = 10^(slider2/20);
fx = cos(2*pi*slider1 / srate);
c = 2-2*fx;
r=(sqrt(2)*sqrt(-(fx-1)^3)+amp*(fx-1))/(amp*(fx-1));

tmp=srate/4;
slider3=tmp;
sliderchange(slider3);

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

speed = speed + (input - pos) * c;
pos = pos + speed;
speed = speed * r;
spl0 = pos;
spl1=pos;

