# Comparing two audio (Phone operator messages)

I have this two wavs. Same audible audio differente data.

The audios are phone operator messages, so they are always the same.

Using this formula I found here i get how similar they are:

https://stackoverflow.com/questions/5847570/use-convolution-to-find-a-reference-audio-sample-in-a-continuous-stream-of-sound

    double[] Data1 = GetMyWav1InDoubles();
double[] Data2 = GetMyWav2InDoubles();
double Mx = Data1.Average();
double My = Data2.Average();

double Denominator1 = Math.Sqrt(Data1.Sum(x => (x - Mx) * (x - Mx)));
double Denominator2 = Math.Sqrt(Data2.Sum(y => (y - My) * (y - My)));
double MaximumNormalizedCrossCorrelation = maxValue / (Denominator1 * Denominator2);


The MaximumNormalizedCrossCorrelation value es 56% similar which is low, considering they sound the same...

I have read I must do FFT and then compare! but I'm lost, I'm using:

http://www.alglib.net/translator/man/manual.csharp.html#example_fft_real_d1

After getting the real part of the result I got this graphs

So, how can i get a similarity percentage?

but how?

• no, the cross-correlation should give you a good result. there is a method of computing cross-correlation using the FFT that should save you instruction cycles. i am surprized it is as low as 0.56. are you sure that the durations are the same? could it be possible that one was "stretched" a little in time relative to the other? – robert bristow-johnson May 8 at 23:18
• where is maxValue defined in your code? and x and y? – robert bristow-johnson May 8 at 23:20
• maxvalue is the highest double in both series, and x and y is the variable of the lambda! thats c# code. (x=> x * 1) x is the value of the item inside de array – Fraga May 8 at 23:42
• where/how is your cross-correlation computed? – robert bristow-johnson May 8 at 23:44
• alglib.net/translator/man/manual.csharp.html#sub_corrr1d – Fraga May 8 at 23:48