Pages: [1]   Go Down
Author Topic: 8 bit Arduino FFT library on Google Code  (Read 3328 times)
0 Members and 1 Guest are viewing this topic.
Boston Suburbs
Offline Offline
God Member
*****
Karma: 14
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged

When the testing is complete there will be... cake.

Rome
Offline Offline
God Member
*****
Karma: 1
Posts: 987
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)?
« Last Edit: March 26, 2011, 03:34:50 pm by jumpjack » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Minneapolis, MN USA
Offline Offline
Full Member
***
Karma: 2
Posts: 162
Never catch a falling soldering iron...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Rome
Offline Offline
God Member
*****
Karma: 1
Posts: 987
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

whi doesn't O.P. reply?!?
Logged

Sydney, Australia
Offline Offline
Full Member
***
Karma: 3
Posts: 230
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Is life really that serious...??!

Rome
Offline Offline
God Member
*****
Karma: 1
Posts: 987
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley
Logged

Boston Suburbs
Offline Offline
God Member
*****
Karma: 14
Posts: 955
I am above your silly so-called "Laws", Mister Ohm.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 30, 2011, 09:04:59 am by focalist » Logged

When the testing is complete there will be... cake.

Portugal
Offline Offline
God Member
*****
Karma: 5
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 10
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I am amazed to see what happend with the code i hacked together on a rainy sunday afternoon smiley
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)
Logged

Pages: [1]   Go Up
Jump to: