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

2012-03-29 Thread Ed Kelly
Hi Peter,

Oh dear! I'm not allowed to release this to anybody!
I did eventually come up with a way to get round this - a new filter external 
that is now part of the app.
If and when I get an iPhone I'll try to recreate the problem with a less 
commercially sensitive patch.
Best,
Ed

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



 From: Peter Brinkmann peter.brinkm...@googlemail.com
To: Ed Kelly morph_2...@yahoo.co.uk 
Cc: Joe White j...@rjdj.me; PD List pd-list@iem.at; pddev pd-...@iem.at 
Sent: Friday, 23 March 2012, 0:04
Subject: Re: [PD-dev] Filter design for iPhone
 
Hi Ed,
The attached files are just the Pd patch and abstractions.  We'll
probably need the entire app to get a sense of what's going wrong
here.
Cheers,
      Peter


On Thu, Mar 22, 2012 at 11:52 AM, Ed Kelly morph_2...@yahoo.co.uk wrote:
 [...]
 I will look at the RJDJ filters mentioned also. I would like not to have to
 worry about filters when programming libpd audio engines.

Absolutely.  If a patch works with Pd Vanilla, then it ought to work
with libpd.  Would you mind filing a bug report at GitHub, ideally
with a minimal example that reproduces the problem?
Thanks,
     Peter
 Sure, although this is ofxPd from Dan Wilcox, so I'm not sure what the 
 difference is between this and the iOS or Android versions.

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


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

2012-03-24 Thread Ed Kelly
 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.17f;
    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-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


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

2012-03-24 Thread Ed Kelly
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.17f;

is replaced by...

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

...and it works.

Ed

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



 From: Ed Kelly morph_2...@yahoo.co.uk
To: Mathieu Bouchard ma...@artengine.ca 
Cc: PD List pd-list@iem.at; Joe White j...@rjdj.me; pddev pd-...@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.17f;
    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-...@iem.at
http://lists.puredata.info/listinfo/pd-dev___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


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

2012-03-24 Thread Ed Kelly
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.17f;


 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_2...@yahoo.co.uk
To: Mathieu Bouchard ma...@artengine.ca 
Cc: PD List pd-list@iem.at; Joe White j...@rjdj.me; pddev pd-...@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.17f;
    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-...@iem.at
http://lists.puredata.info/listinfo/pd-dev___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


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

2012-03-24 Thread Peter Brinkmann
On Sat, Mar 24, 2012 at 5:20 AM, Ed Kelly morph_2...@yahoo.co.uk wrote:
 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.17f;

 is replaced by...

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

 ...and it works.

 and then breaks again

Inf - Inf is NaN.  If the value of xb4 spirals out of control, that
may happen here.  That would also explain why it takes longer to fail
when you reduce the last factor.


 Gemnotes-0.1alpha: Live music notation for Pure Data
 http://sharktracks.co.uk/
 
 From: Ed Kelly morph_2...@yahoo.co.uk
 To: Mathieu Bouchard ma...@artengine.ca
 Cc: PD List pd-list@iem.at; Joe White j...@rjdj.me; pddev pd-...@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.17f;
     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-...@iem.at
 http://lists.puredata.info/listinfo/pd-dev





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


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


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

2012-03-24 Thread Ed Kelly
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.

It is of course, unstable if the frequency is 0 or 1 (where 1 is the Nyquist 
frequency) but there is a safe mode


I'm going to give it a try with this filter and see if any of my colleagues can 
break it :)

Ed

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



 From: Peter Brinkmann peter.brinkm...@googlemail.com
To: Ed Kelly morph_2...@yahoo.co.uk 
Cc: PD List pd-list@iem.at 
Sent: Saturday, 24 March 2012, 15:08
Subject: Re: [PD] [PD-dev] Filter design for iPhone
 
On Sat, Mar 24, 2012 at 5:20 AM, Ed Kelly morph_2...@yahoo.co.uk wrote:
 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.17f;

 is replaced by...

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

 ...and it works.

 and then breaks again

Inf - Inf is NaN.  If the value of xb4 spirals out of control, that
may happen here.  That would also explain why it takes longer to fail
when you reduce the last factor.


 Gemnotes-0.1alpha: Live music notation for Pure Data
 http://sharktracks.co.uk/
 
 From: Ed Kelly morph_2...@yahoo.co.uk
 To: Mathieu Bouchard ma...@artengine.ca
 Cc: PD List pd-list@iem.at; Joe White j...@rjdj.me; pddev pd-...@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.17f;
     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-...@iem.at
 http://lists.puredata.info/listinfo/pd-dev





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


mvcf~.tar.gz
Description: application/gzip
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


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

2012-03-22 Thread Peter Brinkmann
On Wed, Mar 21, 2012 at 8:39 PM, Ed Kelly morph_2...@yahoo.co.uk wrote:
 [...]
 I will look at the RJDJ filters mentioned also. I would like not to have to
 worry about filters when programming libpd audio engines.

Absolutely.  If a patch works with Pd Vanilla, then it ought to work
with libpd.  Would you mind filing a bug report at GitHub, ideally
with a minimal example that reproduces the problem?
Thanks,
 Peter

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


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

2012-03-22 Thread Ed Kelly
 [...]
 I will look at the RJDJ filters mentioned also. I would like not to have to
 worry about filters when programming libpd audio engines.

Absolutely.  If a patch works with Pd Vanilla, then it ought to work
with libpd.  Would you mind filing a bug report at GitHub, ideally
with a minimal example that reproduces the problem?
Thanks,
     Peter 
Sure, although this is ofxPd from Dan Wilcox, so I'm not sure what the 
difference is between this and the iOS or Android versions.

Best,
Ed

filtertest_list.tar.gz
Description: GNU Zip compressed data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


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

2012-03-22 Thread Peter Brinkmann
Hi Ed,
The attached files are just the Pd patch and abstractions.  We'll
probably need the entire app to get a sense of what's going wrong
here.
Cheers,
  Peter


On Thu, Mar 22, 2012 at 11:52 AM, Ed Kelly morph_2...@yahoo.co.uk wrote:
 [...]
 I will look at the RJDJ filters mentioned also. I would like not to have to
 worry about filters when programming libpd audio engines.

Absolutely.  If a patch works with Pd Vanilla, then it ought to work
with libpd.  Would you mind filing a bug report at GitHub, ideally
with a minimal example that reproduces the problem?
Thanks,
     Peter
 Sure, although this is ofxPd from Dan Wilcox, so I'm not sure what the 
 difference is between this and the iOS or Android versions.

 Best,
 Ed

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


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

2012-03-21 Thread Ed Kelly
mvcf~ - Well, it breaks when the Q is high and freq is moderately high, or at 
high freq and Q, but it seems to be that the higher you get with either 
frequency or Q it has a greater probability of breaking (all  dac~ outputs at 1 
(or possibly 1e+07), no more audio can be played by the patch.
 
What I mean is that with the noise~ object as the input, the filter breaks 
after about 1-3 seconds when Q=0.70-0.8, f=0.7-0.8, and there are variations on 
this depending on the settings. Something is profoundly un-robust about this 
filter, but it's cpu load is very low. I want to have a stable version for not 
much more CPU.

I will look at the RJDJ filters mentioned also. I would like not to have to 
worry about filters when programming libpd audio engines. It would be nice to 
get a really efficient IIR with a musical response that uses low CPU into the 
core - I am not an expert at using poles and zeroes however (but I'm working on 
my higher math often these days, with the Khan academy :) Some of this is 
subjective, perhaps the musical nature of filters, but certain types of 
filter are assumed by many (musicians, DJs etc) in this part of the world to be 
normally available. The 24dB lowpass resonant filter a la Moog is one of them, 
and a fundamental analogue processor as well. I understand the analogue better 
than the discrete, so I'm anxious to know what limit is reached in the 
coefficients of the filter that causes the undefined result (NaN).

But I'll try the other rjlib filters first!
Ed

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



 From: Joe White j...@rjdj.me
To: Ed Kelly morph_2...@yahoo.co.uk 
Cc: PD List pd-list@iem.at; pddev pd-...@iem.at 
Sent: Tuesday, 20 March 2012, 17:50
Subject: Re: [PD-dev] Filter design for iPhone
 

Hi Ed,

I just tested your filtertest_list patch in RjDj and it worked exactly as 
expected. As Rich suggested maybe you're using an outdated version of libpd?

If Frank's around I'm sure he would know for certain but if I remember rightly 
the [u_lowpass] / [u_beequad] combination is not really designed for 
dynamically changing parameters. Maybe take a look at [e_reslop], [e_lop2] and 
[e_lop4] for some other filter implementations. 

Regarding your second attempt, at what frequency does it 'break' and what's 
your sampling rate?

Cheers,
Joe


On 20 March 2012 05:57, Ed Kelly morph_2...@yahoo.co.uk wrote:

Hi,


I'm trying to design or find a resonant lowpass filter for use with libPd for 
Openframeworks running on an iPhone 4.


1. I've tried the rjlib filter attached (filtertest_list.tar.gz) and it works 
fine in Pd, but instantly breaks when I run it on the iPhone - all other 
playing audio cuts out, and it is impossible to reset. I suspect that the 
buffers fb1 fb2 ff1 ff2 ff3 are hitting NAN values and staying there, but I 
haven't tested this.


2. I've had a go at implementing the filter from 
http://www.musicdsp.org/archive.php?classid=3#25 as a Pd external 
(mvcf~.tar.gz) and it is very efficient CPU-wise. However, higher values of f 
or q cause the internal filter buffers to hit NAN and stay there (tested in Pd 
- I haven't tried this on the iPhone yet).


I would ideally like to find out why the second attempt breaks at high q 
and/or f, as what I want is a 24dB/Octave moog-ish filter. I'm sure those of 
you with higher math skills will intuitively know why, but I'm just learning 
calculus now (my early education was a bit chaotic). I'm also limited by the 
fact that this is for a commercial project (although I'll be happy to share 
the code :) so I can't just take a GPL external and recompiled libpd with it.

 
Ed


Gemnotes-0.1alpha: Live music notation for Pure Data
http://sharktracks.co.uk/
___
Pd-dev mailing list
pd-...@iem.at
http://lists.puredata.info/listinfo/pd-dev

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


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

2012-03-21 Thread Ed Kelly
They updated libpd to the latest last week.
More info to follow.

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



 From: Rich E reakina...@gmail.com
To: Ed Kelly morph_2...@yahoo.co.uk 
Cc: PD List pd-list@iem.at; pddev pd-...@iem.at 
Sent: Tuesday, 20 March 2012, 16:37
Subject: Re: [PD-dev] Filter design for iPhone
 

What do you mean by break, crashes?  If yes, what version of libpd are you 
using?  Up until about a month ago, floating point exceptions (such as NAN) 
would crash libpd, whereas pd-vanilla ignores them.  Peter B. recently added a 
commit that changed this:

https://github.com/libpd/libpd/commit/27c848a56d3d27e62231f8b0d9ef17c7c56cd9f9

Anywho, you'll probably want to take care of those NAN's anyway. :)  Not sure 
why pd vanilla ignores SIGFPE.

cheers,
Rich



On Tue, Mar 20, 2012 at 4:57 PM, Ed Kelly morph_2...@yahoo.co.uk wrote:

Hi,


I'm trying to design or find a resonant lowpass filter for use with libPd for 
Openframeworks running on an iPhone 4.


1. I've tried the rjlib filter attached (filtertest_list.tar.gz) and it works 
fine in Pd, but instantly breaks when I run it on the iPhone - all other 
playing audio cuts out, and it is impossible to reset. I suspect that the 
buffers fb1 fb2 ff1 ff2 ff3 are hitting NAN values and staying there, but I 
haven't tested this.


2. I've had a go at implementing the filter from 
http://www.musicdsp.org/archive.php?classid=3#25 as a Pd external 
(mvcf~.tar.gz) and it is very efficient CPU-wise. However, higher values of f 
or q cause the internal filter buffers to hit NAN and stay there (tested in Pd 
- I haven't tried this on the iPhone yet).


I would ideally like to find out why the second attempt breaks at high q 
and/or f, as what I want is a 24dB/Octave moog-ish filter. I'm sure those of 
you with higher math skills will intuitively know why, but I'm just learning 
calculus now (my early education was a bit chaotic). I'm also limited by the 
fact that this is for a commercial project (although I'll be happy to share 
the code :) so I can't just take a GPL external and recompiled libpd with it.

 
Ed


Gemnotes-0.1alpha: Live music notation for Pure Data
http://sharktracks.co.uk/
___
Pd-dev mailing list
pd-...@iem.at
http://lists.puredata.info/listinfo/pd-dev

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


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

2012-03-21 Thread Mathieu Bouchard

Le 2012-03-22 à 00:39:00, Ed Kelly a écrit :

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.


 __
| Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


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

2012-03-20 Thread Rich E
What do you mean by break, crashes?  If yes, what version of libpd are you
using?  Up until about a month ago, floating point exceptions (such as NAN)
would crash libpd, whereas pd-vanilla ignores them.  Peter B. recently
added a commit that changed this:

https://github.com/libpd/libpd/commit/27c848a56d3d27e62231f8b0d9ef17c7c56cd9f9

Anywho, you'll probably want to take care of those NAN's anyway. :)  Not
sure why pd vanilla ignores SIGFPE.

cheers,
Rich

On Tue, Mar 20, 2012 at 4:57 PM, Ed Kelly morph_2...@yahoo.co.uk wrote:

 Hi,

 I'm trying to design or find a resonant lowpass filter for use with libPd
 for Openframeworks running on an iPhone 4.

 1. I've tried the rjlib filter attached (filtertest_list.tar.gz) and it
 works fine in Pd, but instantly breaks when I run it on the iPhone - all
 other playing audio cuts out, and it is impossible to reset. I suspect that
 the buffers fb1 fb2 ff1 ff2 ff3 are hitting NAN values and staying there,
 but I haven't tested this.

 2. I've had a go at implementing the filter from
 http://www.musicdsp.org/archive.php?classid=3#25 as a Pd external
 (mvcf~.tar.gz) and it is very efficient CPU-wise. However, higher values of
 f or q cause the internal filter buffers to hit NAN and stay there (tested
 in Pd - I haven't tried this on the iPhone yet).

 I would ideally like to find out why the second attempt breaks at high q
 and/or f, as what I want is a 24dB/Octave moog-ish filter. I'm sure those
 of you with higher math skills will intuitively know why, but I'm just
 learning calculus now (my early education was a bit chaotic). I'm also
 limited by the fact that this is for a commercial project (although I'll be
 happy to share the code :) so I can't just take a GPL external and
 recompiled libpd with it.

 Ed

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

 ___
 Pd-dev mailing list
 pd-...@iem.at
 http://lists.puredata.info/listinfo/pd-dev


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


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

2012-03-20 Thread Joe White
Hi Ed,

I just tested your filtertest_list patch in RjDj and it worked exactly as
expected. As Rich suggested maybe you're using an outdated version of libpd?

If Frank's around I'm sure he would know for certain but if I remember
rightly the [u_lowpass] / [u_beequad] combination is not really designed
for dynamically changing parameters. Maybe take a look at [e_reslop],
[e_lop2] and [e_lop4] for some other filter implementations.

Regarding your second attempt, at what frequency does it 'break' and what's
your sampling rate?

Cheers,
Joe

On 20 March 2012 05:57, Ed Kelly morph_2...@yahoo.co.uk wrote:

 Hi,

 I'm trying to design or find a resonant lowpass filter for use with libPd
 for Openframeworks running on an iPhone 4.

 1. I've tried the rjlib filter attached (filtertest_list.tar.gz) and it
 works fine in Pd, but instantly breaks when I run it on the iPhone - all
 other playing audio cuts out, and it is impossible to reset. I suspect that
 the buffers fb1 fb2 ff1 ff2 ff3 are hitting NAN values and staying there,
 but I haven't tested this.

 2. I've had a go at implementing the filter from
 http://www.musicdsp.org/archive.php?classid=3#25 as a Pd external
 (mvcf~.tar.gz) and it is very efficient CPU-wise. However, higher values of
 f or q cause the internal filter buffers to hit NAN and stay there (tested
 in Pd - I haven't tried this on the iPhone yet).

 I would ideally like to find out why the second attempt breaks at high q
 and/or f, as what I want is a 24dB/Octave moog-ish filter. I'm sure those
 of you with higher math skills will intuitively know why, but I'm just
 learning calculus now (my early education was a bit chaotic). I'm also
 limited by the fact that this is for a commercial project (although I'll be
 happy to share the code :) so I can't just take a GPL external and
 recompiled libpd with it.

 Ed

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

 ___
 Pd-dev mailing list
 pd-...@iem.at
 http://lists.puredata.info/listinfo/pd-dev


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