""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. And I still do. The reason being that I checked the code of other objects like [biquad~], and "last" and "prev" where names used both for input and output operations, the difference being that the math for the output operation was something like *out++ + coef1 * last + coef2 * prev  instead of *in++ + coef1 * last + coef2 * prev (like bp~) .

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

One way or another, input or output samples, seems pretty clear to me you could achieve [bp~] with [biquad~] coefficients. I think the tricky part now is getting to the coefficients and gain values.

Cheers



2014-04-11 3:23 GMT-03:00 volker böhm <vboehm@gmx.ch>:

On 11.04.2014, at 03:07, Alexandre Torres Porres wrote:

> hey, the code I sent only calculates the coeficients, but I left out an important part which is
>
> t_sample output = *in++ + coef1 * last + coef2 * prev;
>
>         *out++ = gain * output;
>
>         prev = last;
>
>         last = output;
>
>
>
> This shows how the filter is done with those coefficients
>
>
>
> It's easy to implement this with [fexpr~], it goes something like:
>
>
>
> [fexpr~ $x + (coef1 * $x1[-1]) + (coef2 * $x1[-2])]

"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.
vb


_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list