How can I Compare 2 Audio Files Programmatically?
Solution 1
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/
Solution 2
I know the question has been asked a long time ago, but a clear answer could help someone else.
-
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.
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 ;)
Solution 3
- 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
Solution 4
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
Shishir.bobby
From Java to Android to iOS App Developer to Project Manager(now).
Updated on June 27, 2022Comments
-
Shishir.bobby about 2 years
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?