The correct way to test an FFT program is to prepare input data with a known transform, and verify that the FFT operation gives the expected result (except for a possible amplitude scale factor).
For example, prepare a simple sine wave input and verify that the resulting power spectrum has a single peak at the correct frequency.
The following code does that to test a much faster version of the FFT than the one you are using.
/*
fft_test_sine
example sketch for testing the OpenMusicLabs fft library.
This generates a simple sine wave data set consisting
of two frequences f1 and f2, transforms it, calculates
and prints the amplitude of the transform.
*/
// do #defines BEFORE #includes
#define LIN_OUT 1 // use the lin output function
#define FFT_N 64 // set to 64 point fft
#include <FFT.h> // include the library
void setup() {
Serial.begin(9600); // output on the serial port
}
void loop() {
int i,k;
float f1=2.0,f2=5.0; //the two input frequencies (bin values)
for (i = 0 ; i < FFT_N ; i++) { // create samples
// amplitudes are 1000 for f1 and 500 for f2
k=1000*sin(2*PI*f1*i/FFT_N)+500.*sin(2*PI*f2*i/FFT_N);
fft_input[2*i] = k; // put real data into even bins
fft_input[2*i+1] = 0; // set odd bins to 0
}
fft_window(); //Try with and without this line, it smears
fft_reorder(); // reorder the data before doing the fft
fft_run(); // process the data using the fft
fft_mag_lin(); // calculate the magnitude of the output
// print the frequency index and amplitudes
Serial.println("bin amplitude");
for (i=0; i<FFT_N/2; i++) {
Serial.print(i);
Serial.print(" ");
Serial.println(2*fft_lin_out[i]); //*2 for "negative frequency" amplitude
}
Serial.println("Done");
while(1); //wait here
}