Fast Fourier Transform (561179)

Hi
I’ve been doing some beats detection project. Now I am able to detection some beats. According to the article I read, the rest part of beats detection must be done with FFT function. I’ve been search some algorithm but it’s kind of difficult for me to understand. Is there anyone who’s done with this? Or can someone provide me something to read or to do with,please. Thanks so much.

You don’t really need to understand how the FFT works, but you do need to know what it does. Basically what the FFT does is, it takes a part of a signal, like a song, and converts it to a list frequencies. Then you know how much of each frequency there is in that part of the signal, or song.

You could use AudioSource.GetSpectrumData, which gives you the result of an FFT done on the sound that’s currently playing.

If you want to be more precise, you could use Audioclip.GetData to get the samples you want and then do an FFT on them with something like this:
http://www.lomont.org/Software/Misc/FFT/LomontFFT.html

1 Like

Hi,
Thanks for replying. So you meant that if I use AudioSource.GetSpectrumData, the datas I get already proceed by FFT?? Because that’s what I am using right now.

Yes. AudioSource.GetSpectrumData gives you a frequency spectrum like the bottom graph in the picture.

Wa, thanks for explanation. I never get that…haha. So that means that I don’t really have to do FFT, right? Because I already got the frequency by using GetSpectrum. That’s what I thought, if it’s wrong please correct me.

GetSpectrum does an FFT internally.

1 Like

Good to hear that. Then I don’t have to implement my own FFT function. BTW,thanks for telling me that

i need FFT function of a function, nof of a sound, for example, if i input the function: Mathf.Sin(somevalue), it returns somevalue