<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>I think I've got a handle on this now. As you said, xb4 spirals out of control, so there are a couple of clamping factors that reduce xb4, hopefully below a threshold where it is stable.</span></div><div><br><span></span></div><div><span>It is of course, unstable if the frequency is <0 or >1 (where 1 is the Nyquist frequency) but there is a "safe" mode<br></span></div><div><br><span></span></div><div><span>I'm going to give it a try with this filter and see if any of my colleagues can break it :)</span></div><div><br><span></span></div><div><span>Ed<br></span></div><div> </div><div>Gemnotes-0.1alpha: Live music notation for Pure Data<br>http://sharktracks.co.uk/<br></div> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new
york,times,serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1"> <b><span style="font-weight: bold;">From:</span></b> Peter Brinkmann <peter.brinkmann@googlemail.com><br> <b><span style="font-weight: bold;">To:</span></b> Ed Kelly <morph_2016@yahoo.co.uk> <br><b><span style="font-weight: bold;">Cc:</span></b> PD List <pd-list@iem.at> <br> <b><span style="font-weight: bold;">Sent:</span></b> Saturday, 24 March 2012, 15:08<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [PD] [PD-dev] Filter design for iPhone<br> </font> </div> <br>On Sat, Mar 24, 2012 at 5:20 AM, Ed Kelly <<a ymailto="mailto:morph_2016@yahoo.co.uk" href="mailto:morph_2016@yahoo.co.uk">morph_2016@yahoo.co.uk</a>> wrote:<br>> My mistake<br>><br>>> Ah.<br>>> As often happens, as soon as I have pressed "send" and posted the<br>>> question, the answer pops out.<br>>> xb4 = xb4 - xb4 * xb4 *
xb4 * 0.166667f;<br>>><br>>> is replaced by...<br>>><br>>> xb4 = xb4 - xb4 * xb4 * xb4 * 0.01f;<br>>><br>>> ...and it works.<br>><br>> and then breaks again<br><br>Inf - Inf is NaN. If the value of xb4 spirals out of control, that<br>may happen here. That would also explain why it takes longer to fail<br>when you reduce the last factor.<br><br>><br>> Gemnotes-0.1alpha: Live music notation for Pure Data<br>> <a href="http://sharktracks.co.uk/" target="_blank">http://sharktracks.co.uk/</a><br>> ________________________________<br>> From: Ed Kelly <<a ymailto="mailto:morph_2016@yahoo.co.uk" href="mailto:morph_2016@yahoo.co.uk">morph_2016@yahoo.co.uk</a>><br>> To: Mathieu Bouchard <<a ymailto="mailto:matju@artengine.ca" href="mailto:matju@artengine.ca">matju@artengine.ca</a>><br>> Cc: PD List <<a ymailto="mailto:pd-list@iem.at"
href="mailto:pd-list@iem.at">pd-list@iem.at</a>>; Joe White <<a ymailto="mailto:joe@rjdj.me" href="mailto:joe@rjdj.me">joe@rjdj.me</a>>; pddev <<a ymailto="mailto:pd-dev@iem.at" href="mailto:pd-dev@iem.at">pd-dev@iem.at</a>><br>> Sent: Saturday, 24 March 2012, 8:47<br>> Subject: Re: [PD-dev] [PD] Filter design for iPhone<br>><br>>>> I'm anxious to know what limit is reached in the coefficients of the<br>>>> filter that causes the undefined result (NaN).<br>>><br>>>I haven't seen the code, but I just want to make you notice that adding<br>>> together -Infinity and +Infinity results in a NaN ; so does subtracting<br>>>two infinities of the same sign.<br>>><br>>>So, the NaN might happen when two expressions that are supposed to<br>>> partially cancel each other, happen to both overflow, in different<br>>> directions.<br>>><br>>>There are various
possible causes for NaN, but with formulas that only<br>>> involve +, - and *, the possibilities are a lot more limited.<br>><br>> Hmmm.<br>> I think that's why it puzzles me so. Can you see a / anywhere here?<br>><br>> while (n--) {<br>> i1=(*in++);<br>> fc1 = (*fc++);<br>> res1 = (*res++);<br>> q = 1.0f - fc1;<br>> p = fc1 + 0.8f * fc1 * q;<br>> fcoeff = p + p - 1.0f;<br>> q = res1 * (1.0f + 0.5f * q * (1.0f - q + 5.6f * q * q));<br>> i1 -= q * xb4;<br>> t1 = xb1;<br>> xb1 = (i1 + xb0) * p - xb1 * fcoeff;<br>> t2 = xb2;<br>> xb2 = (xb1 + t1) * p - xb2 * fcoeff;<br>> t1 = xb3;<br>> xb3 = (xb2 + t2) * p - xb3 *
fcoeff;<br>> xb4 = (xb3 + t1) * p - xb4 * fcoeff;<br>> xb4 = xb4 - xb4 * xb4 * xb4 * 0.166667f;<br>> xb0 = i1;<br>> *out++ = xb4;<br>> }<br>><br>> No reciprocals, no divisions, just +,-,*.<br>> I cannot help thinking I must be reaching a "limit" in the calculus sense...<br>><br>> Ed<br>><br>><br>><br>><br>> ______________________________________________________________________<br>> | Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC<br>><br>><br>> _______________________________________________<br>> Pd-dev mailing list<br>> <a ymailto="mailto:Pd-dev@iem.at" href="mailto:Pd-dev@iem.at">Pd-dev@iem.at</a><br>> <a href="http://lists.puredata.info/listinfo/pd-dev" target="_blank">http://lists.puredata.info/listinfo/pd-dev</a><br>><br>><br>><br>><br>><br>>
_______________________________________________<br>> <a ymailto="mailto:Pd-list@iem.at" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list<br>> UNSUBSCRIBE and account-management -><br>> <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/listinfo/pd-list</a><br>><br><br><br> </div> </div> </div></body></html>