Question

I'm a beginner with FFT concepts and so what I understand is that if I put in 1024 signals, I'll get 513 bins back ranging from 0hz to 22050Hz (in the case of a 44100Hz sampling rate). Using KISS FFT in Cinder the getBinSize function returns the expected 513 values for an input of 1024 signals. What I don't understand is why duplicate peaks show up. Running a test audio sample that goes through frequencies (in order) of 20Hz to 22000Hz I see two peaks the entire time. It looks something like:

_____|________|_____

As the audio plays, the peaks seem to move towards each other so the second peak really does seem to be a mirrored duplicate of the first. Every example I've been through seems to just go ahead and plot all 513 values and they don't seem to have this mirroring issue. I'm not sure what I'm missing.

Was it helpful?

Solution

Ok, after reading up on this I found the solution. The reason for the mirroring is because I use an FFT on real numbers (real FFT). The normal FFT as everyone knows works on complex numbers. Hence the imaginary part is "set" to 0 in the real FFT, resulting in a mirroring around the middle (or technically speaking the mirroring is around 0 and N/2).

Here is a detailed discussion: http://www.edaboard.com/thread144315.html (the page is no longer avaliable, but there is a copy on archive.org)

And read p 238 - 242 on this book (Chapter 12). It's fantastic, so buy it. I think there is a free pdf version on the author’s website: http://www.dspguide.com/

OTHER TIPS

You are possibly plotting the magnitude of all 1024 FFT result bins of a 1024 length FFT, but the upper half is just a mirror image of the lower half (since real-only input to a complex fft doesn't provide enough degrees of freedom to make the upper half unique).

The peaks will move towards each other when mirror images of each other about the center.

Another possibility is that your FFT was somehow only of length 512.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top