How to compare two audio data?

Somnath picture Somnath · May 25, 2012 · Viewed 14k times · Source

I will record my own voice and save them as wav files in my computer. Later on I will speak and computer should match my voice command with preexisting/pre-recorded wav files..

Question: How to check two audio data are equal or there is 80%match between two audio?

if(audio1 == audio2)
   DO Task A
else if( audio1 is a bit similar to audio 2)
   DO TASK B
else if( audio1 (80% match) audio 2)
   DO TASK C
end if

What is the best way to compare two audio data?

Answer

the_mandrill picture the_mandrill · May 29, 2012

Unfortunately you won't get anywhere very quickly just trying to compare audio waveforms directly. There is a huge amount of research on speech and speaker recognition and you'll just be re-inventing the wheel if you don't familiarise yourself with the basics. I think you have several choices here depending on what you really want to do

  • Start reading about HMMs, DTW (as mentioned by learnvst), and Mel-frequency Cepstral Coefficients to know where to start.
  • Use an existing speech API such as the Microsoft one which takes care of the low level signal processing, which you can build into your application
  • Use something even higher level such as the Windows Speech Recognition Macros which give you the ability to control aspects of your PC via speech (eg 'Play Purple Haze')

It depends whether you want to learn about the low levels of speech processing (which will involve a significant amount mathematics), or whether you just want something that works with little coding.