Hey all
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
The problem is as a legacy, it was including Mayer's fft.c with it, and I now want to include mayer_realfft functions from m_pd.h instead (or come up with a better way of doing it).
In the current code, I have:
void myflextclass::rfft(int n, float* out) { int N=n; int N2=N>>1; // N/2 mayer_realfft(N,out); n=N2; register float* r = out+1; // real values register float*i = out+N-1; // imaginary while(--n){ // start at position N/2-1 leave out 0 *r=*r**r+*i**i; // Squared Modulus r++;i--; } *(out+N2) = *(out+N2)**(out+N2); // value at N/2+1 *out=*out**out; // value at 0 // Normalize the power spectrum by RMS ? }
Would it be correct to think that I need to import m_pd.h as an EXTERN into a flext function? Such as:
EXTERN "C" { extern void mayer_realfft (...) }
Do I just #include "m_pd.h" as well?
Kinda lost. Help?
d
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
Hi David, when you are using flext you are always including flext.h which in turn includes m_pd.h. Hence, mayer_realfft should be readily available.
greetings, Thomas
Am 05.04.2006 um 14:25 schrieb David Plans Casal:
Hey all
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
The problem is as a legacy, it was including Mayer's fft.c with it, and I now want to include mayer_realfft functions from m_pd.h instead (or come up with a better way of doing it).
In the current code, I have:
void myflextclass::rfft(int n, float* out) { int N=n; int N2=N>>1; // N/2 mayer_realfft(N,out); n=N2; register float* r = out+1; // real values register float*i = out+N-1; // imaginary while(--n){ // start at position N/2-1 leave out 0 *r=*r**r+*i**i; // Squared Modulus r++;i--; } *(out+N2) = *(out+N2)**(out+N2); // value at N/2+1 *out=*out**out; // value at 0 // Normalize the power spectrum by RMS ? }
Would it be correct to think that I need to import m_pd.h as an EXTERN into a flext function? Such as:
EXTERN "C" { extern void mayer_realfft (...) }
Do I just #include "m_pd.h" as well?
Kinda lost. Help?
d
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Thomas Grill http://grrrr.org
On 5 Apr 2006, at 13:47, Thomas Grill wrote:
when you are using flext you are always including flext.h which in turn includes m_pd.h. Hence, mayer_realfft should be readily available.
Oh man, I was /so/ hoping you'd say that ;-)
Thank you,
d
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
On Wed, 2006-04-05 at 13:25 +0100, David Plans Casal wrote:
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
are you serious about that? using the fftw library would be several times faster than the mayer fft ...
tim
-- TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk
Life is really simple, but we insist on making it complicated. Confucius
On 5 Apr 2006, at 13:55, Tim Blechmann wrote:
On Wed, 2006-04-05 at 13:25 +0100, David Plans Casal wrote:
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
are you serious about that? using the fftw library would be several times faster than the mayer fft ...
My aim is indeed to eventually use fftw instead. But I'm just trying to get my head around the concept of making an fftw 'plan' for now...and cleaning up the code for this thing before uploading to SF. Charles Henry sent me a really kind email explaining fftw use, but I just haven't really understood it yet.
Feel free to suggest how you'd do it in the snippet I sent ;-)
My guess is I would use fftw3f (for floats vs double precision), then
fftw_plan plan:
plan=fftwf_plan_r2r_1d(size, input, output, FFTW_R2HC, flags); fftwf_execute(plan);
I'm not sure how to marry fftw's planning idea with the code I've got, which puts real and imaginary results in two arrays:
int N=n; int N2=N>>1; // N/2 mayer_realfft(N,out); n=N2; register float* r = out+1; // real values register float*i = out+N-1; // imaginary while(--n){ // start at position N/2-1 leave out 0 *r=*r**r+*i**i; // Squared Modulus r++;i--; } *(out+N2) = *(out+N2)**(out+N2); // value at N/2+1 *out=*out**out;
cheers,
david
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
My aim is indeed to eventually use fftw instead. But I'm just trying to get my head around the concept of making an fftw 'plan' for now...and cleaning up the code for this thing before uploading to SF. Charles Henry sent me a really kind email explaining fftw use, but I just haven't really understood it yet.
well, you can check the implementation of pd's fft objects in devel ... there you can compare the mayerfft and fftw usage ...
hth ... tim
-- TimBlechmann@gmx.de ICQ: 96771783 http://www.mokabar.tk
All we composers really have to work with is time and sound - and sometimes I'm not even sure about sound. Morton Feldman
On 5 Apr 2006, at 14:20, Tim Blechmann wrote:
Well, you can check the implementation of pd's fft objects in devel ... there you can compare the mayerfft and fftw usage ...
Do you mean in d_fft.c and your support for fftw3 contribution?
Other than that I can only find Ben Saylor's work, in externals/ bsaylor, which is great but somewhat too complex as an illustration.
Thanks for the pointer in any case!
Cheers,
David
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
My stuff's been too far up in the air to distribute... I'm going to try to put out a 0.40 "test" but have to sift through a lot of stuff before it's ready to commit.
cheers Miller
On Thu, Apr 06, 2006 at 12:10:19PM +0100, David Plans Casal wrote:
On 5 Apr 2006, at 14:20, Tim Blechmann wrote:
Well, you can check the implementation of pd's fft objects in devel ... there you can compare the mayerfft and fftw usage ...
Do you mean in d_fft.c and your support for fftw3 contribution?
Other than that I can only find Ben Saylor's work, in externals/ bsaylor, which is great but somewhat too complex as an illustration.
Thanks for the pointer in any case!
Cheers,
David
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Hi Miller
On 9 Apr 2006, at 17:28, Miller Puckette wrote:
My stuff's been too far up in the air to distribute... I'm going to try to put out a 0.40 "test" but have to sift through a lot of stuff before it's ready to commit.
Oh I see, well looking forward to it! I understand Ooura's to be much faster than Mayer's!
Cheers,
David
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com
On Wed, 5 Apr 2006, David Plans Casal wrote:
My aim is indeed to eventually use fftw instead. But I'm just trying to get my head around the concept of making an fftw 'plan' for now...
a man, a plan, fftw...
it's easy. think of it as a fft function taking too many args so that it got split in two parts so that you call two functions instead and pass the result of the first to the second. (but the real reason is that you can reuse the result of the first function for much increased speed)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Wed, 5 Apr 2006, Tim Blechmann wrote:
On Wed, 2006-04-05 at 13:25 +0100, David Plans Casal wrote:
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
are you serious about that? using the fftw library would be several times faster than the mayer fft ...
He's trying to be retro to remind himself of the days back when pastel and fluo were fashionable and Miller used Mayer FFT... oh wait, Miller still uses Mayer FFT.
btw GridFlow now supports FFTW as [#fft].
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada
On Apr 5, 2006, at 1:36 PM, Mathieu Bouchard wrote:
On Wed, 5 Apr 2006, Tim Blechmann wrote:
On Wed, 2006-04-05 at 13:25 +0100, David Plans Casal wrote:
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
are you serious about that? using the fftw library would be several times faster than the mayer fft ...
He's trying to be retro to remind himself of the days back when pastel and fluo were fashionable and Miller used Mayer FFT... oh wait, Miller still uses Mayer FFT.
btw GridFlow now supports FFTW as [#fft].
If someone would do the configure.in/FFTW work, then Pd-extended would be built with FFTW as the native FFT. Tim's existing patch is already included, but there is no way to enable it yet.
It seems to me that if ./configure finds FFTW, it should enable it automatically.
just my two bits..
.hc
________________________________________________________________________ ____
Using ReBirth is like trying to play an 808 with a long stick. -David Zicarelli
Yep' even tho' it's a bit retro, I think it's necessary to keep the mayer_fft calls available for backward compatibility. At the moment I'm using the ooura FFT instead. FFTW still looks in too much`flux to rely on.
cheers M On Wed, Apr 05, 2006 at 10:20:41PM -0400, Hans-Christoph Steiner wrote:
On Apr 5, 2006, at 1:36 PM, Mathieu Bouchard wrote:
On Wed, 5 Apr 2006, Tim Blechmann wrote:
On Wed, 2006-04-05 at 13:25 +0100, David Plans Casal wrote:
I'm trying to use pd's own fft routines in an object I'm trying to help develop and release, built with flext.
are you serious about that? using the fftw library would be several times faster than the mayer fft ...
He's trying to be retro to remind himself of the days back when pastel and fluo were fashionable and Miller used Mayer FFT... oh wait, Miller still uses Mayer FFT.
btw GridFlow now supports FFTW as [#fft].
If someone would do the configure.in/FFTW work, then Pd-extended would be built with FFTW as the native FFT. Tim's existing patch is already included, but there is no way to enable it yet.
It seems to me that if ./configure finds FFTW, it should enable it automatically.
just my two bits..
.hc
Using ReBirth is like trying to play an 808 with a long stick. -David Zicarelli
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Hi Miller, all,
On 6 Apr 2006, at 07:00, Miller Puckette wrote:
Yep' even tho' it's a bit retro, I think it's necessary to keep the mayer_fft calls available for backward compatibility. At the moment I'm using the ooura FFT instead. FFTW still looks in too much`flux to rely on.
Are you using Ooura's FFT lib within m_pd.h already? I can't see it.
Also, is Ooura's rdft the same as mayer's realfft function? I mean, if I were to include Ooura's fft4f.c and use rdft, would it behave the same as mayer_realfft?
CHeers,
David
-- David Plans Casal Researcher, UEA Studios d.casal at uea dot ac dot uk http://www.davidcasal.com