[PD-dev] mayer_realfft usage within flext
David Plans Casal
main at davidcasal.com
Wed Apr 5 15:03:50 CEST 2006
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
More information about the Pd-dev
mailing list