Fast Fourier Transform - number of samples/2 ?

332 views
Skip to first unread message

Jessica Beltrán

unread,
Jun 23, 2013, 9:27:29 PM6/23/13
to music...@googlegroups.com
Hi, I have a question about the FFT.

I'm kind of confuse because as I understand, if the buffer size is of 1024 samples. Then the FFT should give, first, 1024 values, then after extracting only the positive frequencies, should give 512 values, but instead it gives 256 values.

I think the problem comes when calling the FFT with a framesize of 512

 // call the fft and transform the complex numbers
FFT fft = new FFT(sampleSize / 2, -1);

Its suppose that amplitudes are already the correct values, every value being double, I don't why passing sampleSize/2.

Could you tell me why did you do that please?

Thanks in advance.
-Jessica


Jessica Beltrán

unread,
Jun 24, 2013, 12:58:54 AM6/24/13
to music...@googlegroups.com
Hi again, I checked the class FFT and it says this:

    //Sign = -1 is FFT, 1 is IFFT (inverse FFT)
    // Data = Interlaced double array to be transformed.
    // The order is: real (sin), complex (cos)
    // Framesize must be power of 2

So I tested the results, and I found out that the class receive complex numbers (real and imag). As our data is mostly real, we have to put 0's interlaced. This way, we double the number of samples, for that reason we pass sampleSize/2 as an argument.
Then, in the scenario I put, we would have a result of 2048 values, where we are only going to take the positive frequencies which are the first 1024, and then we extract the real and imag values, so we would have 512 values. As it should be.

-Jessica

madebien

unread,
Jan 21, 2014, 2:47:34 AM1/21/14
to music...@googlegroups.com
Hei Jessica Beltran, I have same issue with you, i think that after extracting only the positive frequencies in FFT, should give 512 values not 256, which one is correct ? and which code did you change to get corrcet value ?

thank you 
Message has been deleted

Iftekhar Amin

unread,
Aug 12, 2015, 8:20:59 AM8/12/15
to musicg-api

If imagery component is omitted from spectrogram (real & imagery), how the expected signal (iFFT) would be reconstructed back from the spectrogram (FFT) magnitude/real part with exact phase information?

to my understanding, to re/construct signal (amplitude, frequency & phase) from spectrogram both real & imagery part are required.
Reply all
Reply to author
Forward
0 new messages