Go Down

Topic: Simple FFT Algorithm? (Read 1 time) previous topic - next topic

FFTMaster

Apr 10, 2012, 10:27 pm Last Edit: Apr 11, 2012, 12:35 am by FFTMaster Reason: 1
Hi guys!
If you dont want to read the long story u can skip to the end, where it starts about algorithm.
Some random noob is here(me), but dont stop reading just yet.
I am doing some project that involves music visualisation on arduino, so i thought i'd put some LED matrix dancing to the music. Ordinary FFT stuff, there are lots of such videos on youtube and elsewhere on the internet. I downloaded some random library and script for it, modified it to my needs and it did some nasty stuff, well the thing was working, but some problems existed. Library was Fix_FTT. Actually i  searched a lot and found many different ones(PlainFTT etc.). Well i did not want to dig in someones library and change it, so i went to wikipedia and read about FFT.
So it says there that FFT is used to compute DFT and that DFT is basically transforming one function, that has X as Time into function that has X as frequency. So i saw a lot of algorithms there and even FFTW but all seemed too complicated and i have kinda little time for this stuff(can't use process language since i need code to be on arduino). So i came up with another method and it is what i want to ask u about. Is this what FFT does?
What i did was putting audio output from pc straight into Arduino, then  i collect 128 impulses, then i do following:samples-samples[i-1]. And then based on the result i add +1 to one of the columns.... What i get in the end is columns array with some numbers for each column and MAP() it for my LED matrix. Thats a rough sketch of the algorithm. Why do i do samples-samples[i-1]? I thought that sound is the vibrations so it has to be something like previous voltage - current voltage. Basically now i have information on how frequently do those voltages appear in the ranges(columns) in th time when i gathered samples.Basically it is frequency...
I tried it already and it does visualize the thing. Is it FFT or similar to it? If it is, is it slower/faster than those libraries which are on arduino cc?
Sorry for messy language and for not writing enough.... but well i am in kind of hurry:D

el_supremo

Quote
Is it FFT or similar to it?

Not even close. If it was that simple there would be no need for PlainFFT, Fix_FFT, FFTW etc.
When you subtract the previous measurement from the current one you are computing the slope of the curve which is essentially the derivative (i.e. the rate at which the voltage is changing). So, if you use that to drive the amplitude of a LED it will be brightest where the voltage changes the fastest (usually the loudest part) and dimmest where there's little or no change.

Pete

FFTMaster

#2
Apr 11, 2012, 01:42 am Last Edit: Apr 11, 2012, 01:45 am by FFTMaster Reason: 1

Quote
Is it FFT or similar to it?

Not even close. If it was that simple there would be no need for PlainFFT, Fix_FFT, FFTW etc.
When you subtract the previous measurement from the current one you are computing the slope of the curve which is essentially the derivative (i.e. the rate at which the voltage is changing). So, if you use that to drive the amplitude of a LED it will be brightest where the voltage changes the fastest (usually the loudest part) and dimmest where there's little or no change.

Pete

Okay, but still i think that the visual is pretty okay, i dont really see the difference between FFT and this(Visually).
The key point was not substraction but actually that im measuring voltages and then putting them into categories.
Basically i get the X with frequencies and Y with Voltage... I thought that was the point?
I do understand that im thinking quite naively... but id like to know what is wrong with my logic:D

el_supremo

Quote
but still i think that the visual is pretty okay

If it looks good, that's all that matters.

Pete

FFTMaster

that much is true, but my interest has already been ignited:D
I am searching for the answer in the internet, wiki etc. but still do not understand fully, why my algorithm is not FFT:D
If u know, could u please tell me? I dont care how complicated it is:D

Go Up