Go Down

Topic: 8 bit Arduino FFT library on Google Code (Read 4163 times) previous topic - next topic

focalist

Well, since I never did track down "deif", I put the code originally posted on the forum into discrete files
and put them up on Google Code..  Enjoy all!

http://code.google.com/p/arduino-integer-fft/

TINY lib that performs a tight 8-bit integer FFT, suitable for color organs and the like... I used it for
my spectrum analyzer with video output...

http://arduino.cc/blog/category/fft/
When the testing is complete there will be... cake.

jumpjack

#1
Mar 26, 2011, 09:30 pm Last Edit: Mar 26, 2011, 09:34 pm by jumpjack Reason: 1
This is maybe even cooler you think, as such a libray could allow receiving SMSs on Arduino using a good old Nokia phone! Quite cheaper than the cheapest GSM shield!
Which are its performance? I.e., which frequencies can it detect, and how long does it take to perform analysis?
Cna it detect if one single "main" frequency is present (e.g. 440 Hz)?

loss1234

how hard would it be to use this in a real time audio effect? or to create a sketch which read incoming analog values and using the library, could split the frequencies into multiple outputs?

i have never had the chance to use FFT but i have read about it. i just wonder what you can actually do with it!
thanks

nootropic

Great contribution, Focalist!  Thanks for sharing it.  I'm sure I'll use it in some project soon.

jumpjack


pocketscience

Maybe he's still trying to figure out how to respond to your post about using the FFT library to receive SMS's...? Unless of course you're talking about spectral modelling synthesis? But then where does the Nokia phone fit in that...? Or maybe it's just me that's confused (wouldn't be the first time!).


G.
Is life really that serious...??!

jumpjack


Maybe he's still trying to figure out how to respond to your post about using the FFT library to receive SMS's...? Unless of course you're talking about spectral modelling synthesis? But then where does the Nokia phone fit in that...? Or maybe it's just me that's confused (wouldn't be the first time!).


G.

I'm talking about a python program on nokia phone sending proper audio tones to Arduino upon receiving messages.
But I just got another idea: rather than using different frequencies, the python program could send a sequence of "audio bits" to the Arduino to communicate SMS contents: it wouldn't even require FFT.  :)

focalist

#7
Mar 30, 2011, 03:33 pm Last Edit: Mar 30, 2011, 04:04 pm by focalist Reason: 1
In general, you'd probably be better off doing DFT (discrete transforms) for the short list of frequencies used in DTMF.. I think the processing overhead is going to be a lot lower, and the results a lot cleaner.. a DFT allows you to look for specific  frequencies, while a FFT done this way basically gives a "power level" at each frequency band, and that's a rough estimate, really.  You want specific frequencies, which are going to be resolved much more cleanly by a DFT.

I'm also reviewing an implementation I've found based upon Chan's mathematics packages, however it's an integer sampling/transform done from the ground up in ATMEL assembler.. it was originally written for the 168, so the 328 can handle it, with twice the memory.. it also allows for selectable data windows, which for audio would be best done with Hamm data window rather than the Rectangular the code in this posted lib.. Hamm does slightly better with resolving low frequencies.  Accoring to the author, the code can perform a 128 sample (64 band) FFT, including both the sampling and tranform, as well as data normalizaton (scalars rather than real/imaginary pairs) for output in under 20ms.  That's a crazy calc rate if that's real, but it seems like it may be.. and the code is well-documented.  This lib, though functional, leaves a bit to be desired in terms of docs..

Just to let you all know, I knew next to nothing about Fourier Transformations (other than functionally what it does, not how it works or how to do it) before I decided to make that spectrum analyzer project.  However, not knowing became aggravating.. I wanted know how this stuff works.  If you choose to be self-abusive, start with the FFT link the playground for a good explanation and some usable code.. but the code there was too memory heavy for my use.. the TVout part takes a lot of SRAM for the video buffer.  Also Wikipedia has a good breakdown of FFT vs DFT and that stuff.
When the testing is complete there will be... cake.

Senso

I have and FFT audio spectrum analyzer, running in an Arduino duemilanove, programmed in C in the Avr Studio, and I use the elm-chan FFT code, and I can be pretty fast, I'm using an external 12 bits ADC from Microchip and I can update my lcd at 14-15hz.

deif

Hi

I am amazed to see what happend with the code i hacked together on a rainy sunday afternoon :)
As I wrote in my initial post I did not write the code myself. I found it on the internet and ported it to avr (use code memory for sinwave lookup table) and 8bit operation. 
It would be nice if someone could doubleckeck the math. I am not at all sure if I dit it correctly. It would also be nice if it could be put into a real arduino library. But perhaps the original author should be contacted first.

For me the code did not do what I needed. All I want is to get the base Drum out of the music to drive my dmx light controler. My next try will be something using a FIR filter.

comments to posts from the old forum:
@tendor Reply #4 - 16.11.2010 at 09:17:57
you are of course right:
we should use "pgm_read_byte_near" instead of "pgm_read_word_near"

@Toby Segaran Reply #15 - 11.01.2011 at 04:28:57
One more mistake on my side:
The frequency range  is 7.8Hz to 500Hz
The frequency resolution is 7.8Hz per band (x64)

Go Up