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 _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list