[Sc-devel] FFT ugen using FFTW

Dan Stowell danstowell at gmail.com
Mon Jul 30 19:32:24 PDT 2007


Dear all,

Attached is code for an "FFTW" ugen, which is essentially the FFT ugen
rewritten to use the fftw library. I've written this as a new ugen
rather than a patch to the core ugen, but **only as a temporary
measure** - primarily to facilitate comparison. As has been discussed,
FFT stuff should be a dev discussion topic at symposium, and this is
some food for thought.

This is a compatibility-oriented rewrite but also generalises the ugen
slightly to allow different amounts of overlap and different types of
window function. The output data format, buffer requirements, etc, are
the same as for FFT() so it should behave in exactly the same way -
you can use it with PV ugens followed by IFFT.

The generalisations mean that one or two of the optimisation tricks
from the original ugen are removed. Despite this, the CPU efficiency
of this ugen is comparable or better, in my tests.

One route could be that this becomes the replacement for the FFT ugen
in the core distro, if it is felt to be advantageous. I'm not planning
to do anything like that before those symposium discussions (unless
there's real strong consensus on the mailing list :). But in the
long-term I don't particularly want to maintain a separate FFTW ugen.

To compile it you need the single-precision version of FFTW. In Xcode,
you just need to add libfftw3f.a to the target.

Efficiency comparisons: I run 100 of each ugen (code is in the
helpfile) and watch the CPU usage in Activity Monitor, and these are
my results:

PPC G4 Mac PowerBook, 1.67 GHz:
	Idle:		  2.9 %
	FFT:	48.5 %
	FFTW:	50.1 %

Intel Core 2 Duo iMac, 2 GHz:
	Idle:		  2.6 %
	FFT:	31.5 %
	FFTW:	23.2 %

I'd appreciate reports of tests on other systems, and other feedback
too of course.

Dan

-- 
http://www.mcld.co.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fftw_ugen.zip
Type: application/zip
Size: 5726 bytes
Desc: not available
Url : http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20070730/c9ebf8cc/fftw_ugen.zip


More information about the Sc-devel mailing list