Quote:
Originally Posted by cern.th.skei
and some filtering
Code:
desc:lowpass / weighted average
slider1:0.5<0,1,0.001>weight
@init
n0 = 0;
n1 = 0;
@slider
weight = slider1*slider1; // ???
@sample
spl0 = (n0+=((spl0-n0)*weight)); // lowpass
spl1 -= (n1+=((spl1-n1)*weight)); // highpass
perhaps not scientifically correct, but useful when cpu and simplicity is important.
|
The low/highpass is a perfectly correct RC filter as far as I can tell.
The formula to calculate the "weight" from frequency is:
weight = 1-exp(-2*$pi*fc/srate);
and for time (that is RC time constant) it is:
weight = 1-exp(-1/t); where t is the time it takes the filter to decay to 36.8% of its initial input or reach 63.2% of its final output.
P.S. liteon you accidentally have a seed of 0 in one of your examples.