Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

Is there a way to compare 2 audio files, whereby a percentage of difference will be returned? I am using C# VS08, .net framework 3.5.

Edited: difference in the sound (like for eg. Audio 1: "HELP", Audio 2:"HELP ME PLEASE", it will return the difference in percentage between this 2 audio.)

I am currently saving recorded files in wav format, and its bit rate and quality will also be the same as what will be recorded and compared against. I wish to ask if there is a way to compare the sound (not just the binaries) in 2 audio files of the same properties and same format (WAV), and show the percentage difference between the 2 sounds in the 2 audio files.

Help will be greatly appreciated.

share|improve this question
7  
What you are describing is in the domain of digital signal processing. Bluntly put, if you need to ask how to do it, you are in no shape ready to do it. I very much doubt that .NET has something so sophisticated built-in. –  San Jacinto Feb 21 '10 at 14:06
    
I've seen a research paper on the subject recently: An Industrial-Strength Audio Search Algorithm (PDF) They compare frequency spectra. The technique is used in a popular iPhone app Shazam. –  AnSGri Feb 21 '10 at 14:06
2  
To answer the question we'll need a careful and precise definition of what "similar" means. What do you believe "similar" means in the context of wav files? –  Eric Lippert Feb 21 '10 at 16:04
1  
You're trying to approach a speech recognition problem that serious researchers all over the world have been tackling for decades. As much as this is a cool thing to be able to do, I don't think it's tractable for one person without prior knowledge of DSP, Bayesian networks, classifiers, and so on. –  Phonon Mar 28 '12 at 21:26
2  
Do you really want to compare the difference in audio, or merely in the transcribed text? That's much easier, once you get past the initial hurdle. –  Emre Mar 28 '12 at 21:44
show 2 more comments

migrated from stackoverflow.com Mar 28 '12 at 15:44

This question came from our site for professional and enthusiast programmers.

3 Answers

Could you please define the "percentage of difference"?

For example, please tell us which value do you expect to get:

  • Between two versions of the same file encoded with different settings?
  • Between two versions of the same file, except that one is slightly faster than the other?
  • Between two recordings of the same audio input, but through different microphone/recording equipment?
  • Between two recordings of the same person saying the same word?
  • Between two recordings of the same person saying the same word, with a different prosody (rhythm/melody)?
  • Between two recordings of different persons saying the same word?
  • Between two recordings of the same person saying the same sentence except for a few words?
  • Between a recording of a person and that of a cow?
  • Between a recording of an airplane and music?

What do you want to measure? The speech contents (words)? The melody, rhythm? The overall audio similarity? Encoding/recording equipment differences?

share|improve this answer
3  
Let's not hold our breath; the question is two years old and the OP is AWOL. –  Emre Mar 28 '12 at 23:22
1  
Oops, I have noticed only the (recent) migration date. –  pichenettes Mar 29 '12 at 8:51
add comment

Please get a look at ITU-T P.862. It is standardized form of PESQ (Perceptual Evaluation of Speech Quality), family of standards for evaluating the speech quality as experienced by a user of a telephony system.

This is only around speech (not other audio information). You compare two audio files, source and degraded and you obtain a value in percent or MOS equivalent.

share|improve this answer
2  
Welcome to DSP.stackexchange! Thank you for providing answers, but I suggest to look at the FAQ to improve your answers/questions. Signatures are discouraged -- you "sign" with your registered handle anyway. Also, providing links to external material, examples and clarifications for the approaches you mention in your answers is a good practice :) –  penelope Nov 26 '12 at 12:19
add comment

I am using one javascript function for compare tow audio file. By using the same logic you are able to compare any file in any language.

function compireAudio(){ 
var audio1 = "http://soundjax.com/reddo/86502%5Ealarm.mp3"; 
var audio2 = "http://soundjax.com/reddo/44368%5EALARME.mp3";
var i,j,d;
var matching = 0;
var t = 0;var i,j,d;
var matching = 0;
var t = 0;
var audio1Arr = Array();
var audio1Len = audio1.length;
for (i = 1; i<=audio1Len; i++)
{
    //reverse so its like a stack
    d = audio1.charCodeAt(audio1Len-i);
    for (j = 0; j < 8; j++) 
    {
        audio1Arr.push(d%2);
        d = Math.floor(d/2);
    }
}
var audio2Len = audio2.length;
for (i = 1; i<=audio2Len; i++)
{
    //reverse so its like a stack
    d = audio2.charCodeAt(audio2Len-i);
    for (j = 0; j < 8; j++) 
    {
        if(d%2 == audio1Arr[t])
        {
            matching++;
        }
        d = Math.floor(d/2);
        t++;
    }
}
var avarage = Number(matching)/((Number(t)+Number(audio1Arr.length))/Number(2))*Number(100);
alert('The Matching with the two audio is '+avarage+' %.');

}

share|improve this answer
3  
Directly comparing the bytestream doesn't work. Two recordings can be perceptually indistinguishable but get encoded into two different bystreams with 0% matching according to your code. –  pichenettes May 24 '12 at 15:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.