First time here so sorry in advance for any butchered formatting.
So I am completely new to DSP so I have only a very general understanding of the Fourier Transform.
In case it helps anyone, I've created a Visualizer which takes the output from the MediaPlayer and displays a visualization. It works with both normal waveform and FFT data:
https://github.com/felixpalmer/android-visualizer
It includes code for converting the output of getFft() into something visually meaningful.
The frequency at FFT output sample k is given by:
Fk = k * Fs / N, k = 0,1,...,N-1
where
Fs
is the sampling frequency of the time series inputN
is the number of samples used to compute the FFTThe two sides of the spectrum refers to the positive and negative frequencies in the output of the FFT. The FFT forces the frequency output to be periodic with a period of Fs. If you look at the FFT output, it covers the frequencies from 0 to Fs. It is often advantageous to view the spectrum over the range of -0.5*Fs to 0.5*Fs instead by shifting the FFT output from 0.5*Fs -> Fs to -0.5*Fs -> 0 since they are equal because of the periodicity.
For real-valued signals, like the ones you have in audio processing, the negative frequency output will be a mirror image of the positive frequencies. Because of this, often only one side of the spectrum is used when analyzing real signals.
Another important point is the significance of 0.5*Fs which is known as the Nyquist Frequency. A signal can only accurately represent frequencies up to the Nyquist frequency and anything above it will be aliased (folded) back onto the spectrum causing distortion.
So really all you should worry about for visualization purposes are the FFT output samples corresponding to the range of frequencies from 0 to Fs/2 since those are the meaningful samples for a real signal with sampling rate Fs.