I need to compare FFT result from audio files, I have 2 FFT result from 2 audio files..

FFT 1 (sample)

-0.16314493488504767 - 0.103707391105263i
0.07863935536550609 - 0.30111206509352917i
0.06753127619272284 + 0.02837438103569126i

FFT 2 (sample)

-0.006953384463464084 + 0.0291883094944081i
-0.09447919915711694 - 0.22676541801892i
-0.23493813662827812 - 0.07765408995141115i

Then I need to calculate the deviation of each real-part point (without imaginer part) from the FFT result then make the result absolute, something like this

-0.16314493488504767 - (-0.006953384463464084) 
--> then use Math.abs to get absolute value

then sum all the deviation point, and use Root Mean Square formula to follow with to get the difference value...

Root Mean Square Formula

where N is my numbeofFFTPoint and the following x is the sum value of my deviation result.

But then, someone told me to use Zero crossing rate formula to get more accurate result Zero Crossing rate

Honestly I don't really understand about Zero Crossing Rate,

what have I tried :

I compare the exact same 2 audio files, then get the deviation and sum result --> 0.0 and of course the Root Mean Square Formula result is 0.0 too.. since there's no difference between the files the it would return 0.0 right ??


is it possible just to user Root Mean Square ?? Any advice which formula should I use for this case ?

Thanks :) (sorry 4 bad explaining)

  • $\begingroup$ Im assuming FFT is Fast Fourier transform? Beware acronyms $\endgroup$
    – Richard Tingle
    Commented Jul 16, 2013 at 18:40
  • $\begingroup$ ohh I'm sorry... Yes it's Fast Fourier transform :) $\endgroup$
    – raisa_
    Commented Jul 16, 2013 at 18:41
  • $\begingroup$ While this is clearly related to programming you might find more knowledge with the maths people. The only advise I can offer is test it and see which gives you the better results, if they're the same use the one you're most comfortable with $\endgroup$
    – Richard Tingle
    Commented Jul 16, 2013 at 18:45
  • $\begingroup$ @RichardTingle ahh... indeed, so I really need to ask the math people... O_o thanks 4 response and advice by the way.. :) $\endgroup$
    – raisa_
    Commented Jul 16, 2013 at 18:49
  • $\begingroup$ What is it that you are actually trying to accomplish? Are you trying to determine if some audio is a noisy version of another audio sample (e.g. song identification)? $\endgroup$
    – Jim Clay
    Commented Jul 17, 2013 at 17:45

1 Answer 1


The Discrete Fourier Transform is a unitary transform (maybe scaled). As such, it preserves the Frobenius norm of the signal. That is essentially the same as the Root Mean Square calculation.

In other words:

 rms( x - y ) == C * norm( fft(x) - fft(y) )

for an appropriate constant C depending on your fft implementation.

In Matlab or octave, C=1/nfft:

 sqrt( mean( abs(x-y).^2 ) ) - norm(fft(x) - fft(y)) / n

 ans = -5.3291e-15
  • $\begingroup$ thanks for giving explanation and sample.. It helps a lot.. :) $\endgroup$
    – raisa_
    Commented Jul 19, 2013 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.