Here’s the first draft of my source files for Fourier Transform. Currently the swf expects a sound file named “test.mp3” in the same folder, but you can easily change that. It’s drawing the spectral analysis of the first couple of seconds of sound of that mp3 file. 

I have code lying around to load a file instead, and I’ll see if I can make some time to implement that so I can put up a working example, with paging etc.

Take note that the FFT.as class, which contains the hard core code for the Fourier Transform, is a port from C++, and is copyrighted by the original writer of that code. Please leave in his copyright note when using this code.

I heard that Andre Michelle uses linked lists instead of Vector to speed things up. I didn’t make it to his talk on FitC Amsterdam, unfortunately, so I don’t know the details about that yet, but that might give an extra speed boost here and there. Maybe the butterfly algorithm that FFT uses, can be implemented in this way…

1 Mar, 2009, 20:39 o'clock

Add your own comment or set a trackback

Currently 6 comments

  1. Comment by stephan

    Would be good to try pitch detection yeah, especially with Flash player 10.1 coming up. I haven’t had the time to delve into it, but what I do know about it is that pitch detection is basically a double FFT. Googling should get you more details on that. I suggest you start with something simpler than piano though. Piano tones are known to contain a lot of non harmonic overtones, which will give a lot of misses on the pitch detection if you use double FFT. Voice is prob a better start πŸ˜€

  2. Comment by phil

    hey stephan, i’m pretty new to FFT and it’s uses. But i’m trying to figure out how to do pitch detection on simple sounds. Say for example a single piano note. maybe you could point me in the right direction? πŸ™‚

  3. Comment by makc

    damn, why didn’t I find this post earlierπŸ™

  4. Comment by stephan

    Looks good! I don’t mind you changing package & class name, after all, it’s your effort πŸ™‚ Anything to get this stuff going. Keep me posted on your performance upgrades!

  5. Comment by vFragosop

    Hi again Stephan. I’ve done some testings with your sources. With some minor upgrades it will be running really really fast.
    I’ve uploaded one of the tests and the sources to share with you some ideas.

    Note that I’ve modified the class name and its package cause I rewrote the code to better understand how the work was done without having to overwrite your code so I could compare results.

    But, since I have no intentions besides colaborate with you and learn about fft and complex functions performance, I guess there’s no problem. Please, let me know if you feel uncomfortable about that.

  6. Comment by vFragosop

    Own!!! Nice nice news.. I’ll check out the codes, and hopefully comeback with nice suggestions.. Thanks for the draft and the time spent.
    I’m forwarding this link for some other guys who are interested on Actionscript FFT too.
    Maybe we all can help you!

Add your own comment



Follow comments according to this article through a RSS 2.0 feed

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos from AcidCats. Make your own badge here.