[PD] [PD-dev] Filter design for iPhone

Ed Kelly morph_2016 at yahoo.co.uk
Sat Mar 24 10:20:49 CET 2012


My mistake

> Ah.
> As often happens, as soon as I have pressed "send" and posted the question, the answer pops out.
> xb4 = xb4 - xb4 * xb4 * xb4 * 0.166667f;
>

> is replaced by...
> 

> xb4 = xb4 - xb4 * xb4 * xb4 * 0.01f;
> 

> ...and it works.

and then breaks again

 
Gemnotes-0.1alpha: Live music notation for Pure Data
http://sharktracks.co.uk/


________________________________
 From: Ed Kelly <morph_2016 at yahoo.co.uk>
To: Mathieu Bouchard <matju at artengine.ca> 
Cc: PD List <pd-list at iem.at>; Joe White <joe at rjdj.me>; pddev <pd-dev at iem.at> 
Sent: Saturday, 24 March 2012, 8:47
Subject: Re: [PD-dev] [PD]  Filter design for iPhone
 

>> I'm anxious to know what limit is reached in the coefficients of the filter that causes the undefined result (NaN).

>
>I haven't seen the code, but I just want to make you notice that adding together -Infinity and +Infinity results in a NaN ; so does subtracting 
>two infinities of the same sign.
>
>So, the NaN might happen when two expressions that are supposed to partially cancel each other, happen to both overflow, in different directions.
>
>There are various possible causes for NaN, but with formulas that only involve +, - and *, the possibilities are a lot more limited.

Hmmm.
I think that's why it
 puzzles me so. Can you see a / anywhere here?

  while (n--) {
    i1=(*in++);
    fc1 = (*fc++);
    res1 = (*res++);
    q = 1.0f - fc1;
    p = fc1 + 0.8f * fc1 * q;
    fcoeff = p + p - 1.0f;
    q = res1 * (1.0f + 0.5f * q * (1.0f - q + 5.6f * q * q));
    i1 -= q * xb4;
    t1 = xb1;
    xb1 = (i1 + xb0) * p - xb1 * fcoeff;
    t2 = xb2;
    xb2 = (xb1 + t1) * p - xb2 * fcoeff;
    t1 = xb3;
    xb3 = (xb2 + t2) * p - xb3 * fcoeff;
    xb4 = (xb3 + t1) * p - xb4 * fcoeff;
    xb4 = xb4 - xb4 * xb4 * xb4 * 0.166667f;
    xb0 = i1;
    *out++ = xb4; 
 }

No reciprocals, no divisions, just +,-,*.
I cannot
 help thinking I must be reaching a "limit" in the calculus sense...

Ed




______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC


_______________________________________________
Pd-dev mailing list
Pd-dev at iem.at
http://lists.puredata.info/listinfo/pd-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20120324/dc6a0c27/attachment-0001.htm>


More information about the Pd-list mailing list