[PD] can [bp~] be obtained with biquad coefficients?

volker böhm vboehm at gmx.ch
Fri Apr 11 21:46:18 CEST 2014


On 11.04.2014, at 16:48, Alexandre Torres Porres wrote:

> ""last" and "prev" are the last two _output_ samples.
> i don't know fexpr~ very well, but it looks like you try to access the last _input_ samples."
> 
> In [fexpr~] you can access input samples with $x variables and output samples with $y. So you're correct. I'm going for the input samples.
> 
> But I did it because I believe "last" and "prev" in this formula are in fact about input samples.


no, and it's pretty easy to see that from the code you quoted:

> > t_sample output = *in++ + coef1 * last + coef2 * prev;
> >
> >         *out++ = gain * output;
> >
> >         prev = last;
> >
> >         last = output;


after all it's a resonating filter and therefore needs a feedback path.
so it somehow has to take outgoing samples back in.


> So I feel pretty strong about getting this [fexpr~] right. Is there anything I did not take into consideration? 

yes, calculate coef1, coef2 and gain by using the formulas from the code,
change the [fexpr~] to something like [ fexpr~ $x[0] + ($f2 * $y[-1]) + ($f3 * $y[-2]) ],
(where $f2 and $f3 would be coef1 and coef2 resp.)
apply the gain factor afterwards,
and you are done.

vb






More information about the Pd-list mailing list