[PD] IIR Filter

Sylvain Le Beux slebeux at limsi.fr
Wed Jul 5 15:06:48 CEST 2006


First thank you all Federico, Tim, Miller and Guenter and sorry for that 
late reply but had some troubleshoooting that I'll explain.
I did not manage to properly use block, send & receive but I'll stick at 
it later on.
Günter was actually right about the fact that biquad~ was less CPU 
greedy than fexpr.
But my big problem was somewhere else, as the filter I wanted to 
implement was an unstable one ...
So denormals securities did not allow me to see anything happens while 
using either biquad or fexpr.
I thus decided to modify biquad (as it was less greedy) in order to do 
the calculation even when the coeffs happened to be unstable.
I modify it in a way that allows the user to fix a threshold parameter 
that stop the calculation of the output and after some better knowledge 
of Pd's C-environment, I guess I managed to achieve it but there's still 
some testing to do in order to see if it works fine.
Let me know if anyone but me would be interested in such a behaviour.

Cheers

Sylvain


geiger a écrit :
> On Wed, 28 Jun 2006, Miller Puckette wrote:
>
>   
>> There are two possible solutions.  One is to locally set the block
>> size to one, as in example G04.control.blocksize.pd in 3.audio.examples.
>> The other is to use the powerful vexpr~ object.
>>     
>
> I think performance wise using the biquad~ object is the best solution.
> Check out the help patch for biquad~, it takes 5 arguments, fb1 fb2 ff1
> ff2 and ff3.
>
> set fb1 to -a[1], fb2 to -a[2] and ff1 to 1.
>
> [biquad~ -a[1] -a[2] 1 0 0]
>
> The arguments can only be changed on the message level in this case.
>
> Günter
>
>   
>> On Tue, Jun 27, 2006 at 03:39:47PM +0200, Sylvain Le Beux wrote:
>>     
>>> Hi list,
>>>
>>> I am trying to implement an IIR filter which has the following equation :
>>>
>>> Y[k] + a[1]Y[k-1] + a[2]Y[k-2] = X[k]
>>>
>>> where X[k] is here a dirac to obtain the impulse response of the filter
>>> (of course, first two calculations are set with null samples)
>>> I get stuck as I try to get the feedback loop of the filter and Pd send
>>> me an "DSP loop detected" error message
>>> I know (as I query the Pd archive) there's a way to achieve it by using
>>> block~ but I can't really understand how it works.
>>> I join my patch if anybody can't point me my mistakes or can improve my
>>> implementation
>>>
>>> Thanks for nay help
>>>
>>> Sylvain
>>>       
>>> #N canvas 667 376 465 288 10;
>>> #X obj 46 105 RII;
>>> #X obj 46 65 dirac~;
>>> #X floatatom 108 65 5 0 0 0 - - -;
>>> #X floatatom 151 65 5 0 0 0 - - -;
>>> #X obj 45 161 tabwrite~ RII;
>>> #N canvas 0 0 450 300 graph1 0;
>>> #X array RII 10 float 1;
>>> #A 0 0 0 1 0 0 0 0 0 0 0;
>>> #X coords 0 1 9 -1 200 140 1;
>>> #X restore 230 66 graph;
>>> #X obj 16 17 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
>>> -1;
>>> #X obj 16 40 t b b;
>>> #X msg 38 198 \; RII resize 10;
>>> #X connect 0 0 4 0;
>>> #X connect 1 0 0 0;
>>> #X connect 2 0 0 1;
>>> #X connect 3 0 0 2;
>>> #X connect 6 0 7 0;
>>> #X connect 7 0 4 0;
>>> #X connect 7 1 1 0;
>>>       
>>> #N canvas 125 589 458 308 10;
>>> #X obj 62 137 z~;
>>> #X obj 62 111 z~;
>>> #X obj 62 183 outlet~;
>>> #X obj 91 112 *~;
>>> #X obj 62 44 inlet~;
>>> #X obj 108 44 inlet;
>>> #X obj 134 136 *~;
>>> #X obj 151 44 inlet;
>>> #X obj 118 72 +~;
>>> #X obj 62 79 +~;
>>> #X connect 0 0 6 0;
>>> #X connect 0 0 2 0;
>>> #X connect 1 0 0 0;
>>> #X connect 1 0 3 0;
>>> #X connect 3 0 8 0;
>>> #X connect 4 0 9 0;
>>> #X connect 5 0 3 1;
>>> #X connect 6 0 8 1;
>>> #X connect 7 0 6 1;
>>> #X connect 8 0 9 0;
>>> #X connect 9 0 1 0;
>>>       
>>     
>>> _______________________________________________
>>> PD-list at iem.at mailing list
>>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>>>       
>> _______________________________________________
>> PD-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>>
>>     
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: slebeux.vcf
Type: text/x-vcard
Size: 404 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20060705/83926ff8/attachment.vcf>


More information about the Pd-list mailing list