I attempted to do cross correlation by following these instructions here: fft - How do I implement cross-correlation to prove two audio files are similar? - Signal Processing Beta - Stack Exchange

However I might not understand it correctly, as the results I'm getting are no where between 1 and 0 like it says in that first response. Here is what I am doing:

I realize this is a C board, but I ended up writing this in java, but I figured the syntax was close enough. In this code snippet I generated an FFT for each of my two audio pieces called fft1 and fft2.

Code:

float stdev1;
float stdev2;
stdev1 = find_stdev(fft1);
stdev2 = find_stdev(fft1);
//calculate covariance
double covariance = 0;
for (int i = 0; i < fft1.length; i += 1) {
covariance += (double) fft1[i] * fft2[i];
}
System.out.println("CORRELATION = " + ((double) covariance / (stdev1 * stdev2)) );