Java – use getspectrum() in libgdx Library
I know the first thing you do is "look in the document". The problem is that the document is not clear
I use the library to get FFT. I start with this short guide: http://www.digiphd.com/android-java-reconstruction-fast-fourier-transform-real-signal-libgdx-fft/
The problem is that it uses:
fft.forward(array); fft_cpx=fft.getSpectrum(); tmpi = fft.getImaginaryPart(); tmpr = fft.getRealPart();
"Fft_cpx", "tmpi", "tmpr" are floating vectors Although "tmpi" and "tmpr" are used to calculate size, "fft_cpx" is no longer used
I think getspectrum () is the combination of getreal and getimmaginary, but the values are different Maybe getspectrum is a complex value, but what are their representativeness?
I tried FFT without this linecode_ cpx = fft. getSpectrum(); It seems to work, but I wonder if it's necessary and what's the difference between getspectrum () and getreal () or getimmaginary ()
This is its file: http://libgdx-android.com/docs/api/com/badlogic/gdx/audio/analysis/FFT.html
thank you!
Solution
Getspectrum() returns the absolute value of a complex number
This is how it is calculated
for (int i = 0; i < spectrum.length; i++) { spectrum[i] = (float)Math.sqrt(real[i] * real[i] + imag[i] * imag[i]); }