is root mean square possible to calculate similarity of FFT result?

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...

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

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 ??

question

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

Thanks :) (sorry 4 bad explaining)

• Im assuming FFT is Fast Fourier transform? Beware acronyms
– Richard Tingle
Jul 16, 2013 at 18:40
• ohh I'm sorry... Yes it's Fast Fourier transform :) Jul 16, 2013 at 18:41
• 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
– Richard Tingle
Jul 16, 2013 at 18:45
• @RichardTingle ahh... indeed, so I really need to ask the math people... O_o thanks 4 response and advice by the way.. :) Jul 16, 2013 at 18:49
• 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)? Jul 17, 2013 at 17:45

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:

 n=8192;
x=randn(n,2)*[1;j];
y=randn(n,2)*[1;j];
sqrt( mean( abs(x-y).^2 ) ) - norm(fft(x) - fft(y)) / n

ans = -5.3291e-15

• thanks for giving explanation and sample.. It helps a lot.. :) Jul 19, 2013 at 18:20