How can I Compare 2 Audio Files Programmatically?
Asked Answered
A

4

33

I want to compare 2 audio files programmatically. For example: I have a sound file in my iPhone app, and then I record another one. I want to check if the existing sound matches the recorded sound or not ( - similar to voice recognition).

How can I accomplish this?

Aegospotami answered 8/8, 2011 at 8:18 Comment(0)
S
14

Have a server doing audio fingerprinting computation that is not suitable for mobile device anyway. And then your mobile app uploads your files to the server and gets the analysis result for display. So I don't think programming language implementing it matters much. Following are a few AF implementations.

Java: http://www.redcode.nl/blog/2010/06/creating-shazam-in-java/

VC++: http://code.google.com/p/musicip-libofa/

C#: https://web.archive.org/web/20190128062416/https://www.codeproject.com/Articles/206507/Duplicates-detector-via-audio-fingerprinting

Sliest answered 11/8, 2011 at 16:37 Comment(0)
A
5

I know the question has been asked a long time ago, but a clear answer could help someone else.

  1. The libraries from Echoprint ( website: echoprint.me/start ) will help you solve the following problems :

    • De-duplicate a big collection
    • Identify (Track, Artist ...) a song on a hard drive or on a server
    • Run an Echoprint server with your data
    • Identify a song on an iOS device

    PS: For more music-oriented features, you can check the list of APIs here.

  2. If you want to implement Fingerprinting by yourself, you should read the docs listed as references here, and probably have a look at musicip-libofa on Google Code

Hope this will help ;)

Adigun answered 15/4, 2013 at 19:26 Comment(0)
B
4
  • Apply bandpass filter to reduce noise
  • Normalize for amplitude
  • Calculate the cross-correlation

It can be fairly Mhz intensive.

The DSP details are in the well known text:

  • Digital Signal Processing by Alan V. Oppenheim and Ronald W. Schafer
Beckman answered 18/8, 2011 at 5:13 Comment(1)
That won't take into account the differences in accents and talking speedTanhya
M
2

I think as well you may try to select a few second sample from both audio track, mnormalise them in amplitude and reduce noise with a band pass filter and after try to use a correlator.

for instance you may take a 5 second sample of one of the thwo and made it slide over the second one computing a cross corelation for any time you shift. (be carefull that if you take a too small pachet you may have high correlation when not expeced and you will soffer the side effect due to the croping of the signal and the crosscorrelation). After yo can collect an array with al the results of the cross correlation and get the index of the maximun.

You should then set experimentally up threshould o decide when yo assume the pachet to b the same. this will change depending on the quality of the audio track you are comparing.

I implemented a correator to receive and distinguish preamble in wireless communication. My script is actually done in matlab. if you are interested i can try to find the common part and send it to you.

It would be a too long code to be pasted hene in the forum. if you want just let me know and i will send it to ya asap.

cheers

Mizzle answered 18/8, 2011 at 11:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.