<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Hi,</div></div><div><br></div><div>I'm trying to implement in PD a resonant all pole filter, that I used in max before.</div><div>It is using a biquad~ &nbsp;with some adequate coefficients.</div><div>So I make a patch reproducing the one in max, with respect to compatibility with PD, it means that I change it a little so all the objects used are now common to &nbsp;PD and Max.</div><div>And this patch is working in Max correctly. I tested it with Max 4.5, Mac os 10.5.8 (I don't have Max 5).</div><div>the biquad~ is working with lowpass coefficient (using the 'lowpass' external from ggee) but not with the coefficient that I want to use :-(</div><div><br></div><div>I thought that maybe the PD version was not accepting 0 values for the second and third coefficient of the list so a put 0.000001 value instead of 0 , but it doesn't seem to be this.</div><div><br></div><div>I had a look at Miller's code in the d_filter.c file, in [&nbsp;<span class="Apple-style-span" style="font-family: Monaco; font-size: 10px; "><span style="color: #aa0d91">static</span> <span style="color: #aa0d91">void</span> sigbiquad_list(t_sigbiquad *x, t_symbol *s, <span style="color: #aa0d91">int</span> argc, t_atom *argv) ]</span></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="2"><span class="Apple-style-span" style="font-size: 10px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp;t_float discriminant = fb1 * fb1 + <span style="color: #1c00cf">4</span> * fb2;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; t_biquadctl *c = x-&gt;x_ctl;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; &nbsp; </span><span style="color: #aa0d91">if</span><span style="color: #000000"> (discriminant &lt; </span><span style="color: #1c00cf">0</span><span style="color: #000000">) </span>/* imaginary roots -- resonant filter */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>/* they're conjugates so we just check that the product</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is less than one */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #aa0d91">if</span> (fb2 &gt;= -<span style="color: #1c00cf">1.0f</span>) <span style="color: #aa0d91">goto</span> stable;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; &nbsp; </span><span style="color: #aa0d91">else</span><span style="color: #000000">&nbsp; &nbsp; </span>/* real roots */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; {...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; color: rgb(0, 116, 0); "><span style="color: #000000">&nbsp; &nbsp; &nbsp; &nbsp; </span>/* if unstable, just bash to zero */</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 10px/normal Monaco; ">&nbsp; &nbsp; fb1 = fb2 = ff1 = ff2 = ff3 = <span style="color: #1c00cf">0</span>;</div><div><br></div></span></font></div><div><br></div><div>and I saw something about a stable criteria 'discriminant' , I wonder if it is maybe a reason why it is not working with my coefficient. &nbsp;they are working in Max but not in PD.</div><div><br></div><div>if anyone know the answer, it will be very well come, it's still a mystery for me.</div><div>best,</div><div>loic</div><div><br></div><div>here is my patch:</div><div><br></div><div><div>#N canvas 311 124 720 796 10;</div><div>#X msg 256 523 0.0006 1e-06 1e-06 -1.98252 0.994522;</div><div>#X msg 343 55 1;</div><div>#X obj 343 31 loadbang;</div><div>#X msg 184 71 20;</div><div>#X obj 182 34 loadbang;</div><div>#X msg 25 66 770;</div><div>#X obj 25 43 loadbang;</div><div>#X msg 398 621 0.000599788 0 0 -2 1;</div><div>#X obj 398 598 prepend set;</div><div>#X obj 245 657 dac~;</div><div>#X obj 249 626 biquad~;</div><div>#X obj 111 541 phasor~ 110;</div><div>#X msg 448 90 44100;</div><div>#X obj 448 65 loadbang;</div><div>#X floatatom 381 56 0 0 0 0 - - -;</div><div>#X floatatom 239 59 0 0 0 0 - - -;</div><div>#X floatatom 120 66 0 0 0 0 - - -;</div><div>#X obj 343 77 t b f;</div><div>#X obj 205 498 * 1;</div><div>#X floatatom 218 273 0 0 0 0 - - -;</div><div>#X floatatom 464 374 0 0 0 0 - - -;</div><div>#X obj 79 292 expr 1-($f2/(2*$f1));</div><div>#X obj 460 337 f;</div><div>#X obj 29 435 expr (1-$f1)*sqrt(1-2*$f1*cos(2*$f2)+($f1*$f1));</div><div>#X obj 444 116 / 2;</div><div>#X obj 78 88 t b f;</div><div>#X obj 225 218 / 22050;</div><div>#X obj 95 110 * 3.14159;</div><div>#X text 96 57 fc;</div><div>#X text 196 54 Q;</div><div>#X obj 249 565 pack 0.0006 0 0 -1.98252 0.994522;</div><div>#X text 557 494 b2;</div><div>#X obj 388 458 expr -2*$f1*cos($f2);</div><div>#X obj 519 459 expr $f1*$f1;</div><div>#X text 61 479 a0;</div><div>#X text 395 479 b1;</div><div>#X text 316 56 G;</div><div>#X connect 0 0 30 0;</div><div>#X connect 1 0 17 0;</div><div>#X connect 2 0 1 0;</div><div>#X connect 3 0 21 0;</div><div>#X connect 4 0 3 0;</div><div>#X connect 5 0 25 0;</div><div>#X connect 6 0 5 0;</div><div>#X connect 8 0 7 0;</div><div>#X connect 10 0 9 0;</div><div>#X connect 10 0 9 1;</div><div>#X connect 11 0 10 0;</div><div>#X connect 12 0 24 0;</div><div>#X connect 13 0 12 0;</div><div>#X connect 14 0 17 0;</div><div>#X connect 15 0 21 0;</div><div>#X connect 16 0 25 0;</div><div>#X connect 17 0 21 0;</div><div>#X connect 17 0 27 0;</div><div>#X connect 17 1 18 1;</div><div>#X connect 18 0 30 0;</div><div>#X connect 21 0 22 0;</div><div>#X connect 22 0 23 0;</div><div>#X connect 22 0 32 0;</div><div>#X connect 22 0 20 0;</div><div>#X connect 22 0 33 0;</div><div>#X connect 23 0 18 0;</div><div>#X connect 24 0 26 1;</div><div>#X connect 25 0 21 0;</div><div>#X connect 25 1 27 0;</div><div>#X connect 26 0 21 1;</div><div>#X connect 26 0 19 0;</div><div>#X connect 26 0 23 1;</div><div>#X connect 26 0 32 1;</div><div>#X connect 27 0 26 0;</div><div>#X connect 30 0 10 0;</div><div>#X connect 30 0 8 0;</div><div>#X connect 32 0 30 3;</div><div>#X connect 33 0 30 4;</div><div><br></div></div></body></html>