Okay, round 2.
The issue I am having with implementing FFT is that different implementations require passing as arguments different types of data. From the WAV file you obtain samples of the amplitude recorded at the sample rate.
As an example, the NAudio library takes an array of complex numbers as an argument: source code
public static void FFT(bool forward, int m, Complex[] data)
On the other hand, the source code for another implementation simply takes an array of doubles:
static public double[] FFTDb(ref double[] x)
My questions are,
- Why are they using different arguments -- is it simply a preference or some other factor?
- How do I go from the samples in the WAV data to the form they are asking for? Do I simply cast the 16-bit integers to double? Do I zero out the imaginary part?
As for the output of the FFT function, I'm left with, in the case of the former, the original array modified by the FFT or, in the case of the latter, an array of doubles. From my understanding each index in the output represents a range of frequencies depending on the sampling rate and the time resolution (number of samples passed).
Am I right in concluding I simply find the magnitude of that index to determine the presence of that frequency range over the time interval of samples?
Also, how do channels factor in to all of this? Do you separate the channels and run the FFT on each channel? Do you combine the channels after words? Do you examine them independently?