I am new to MATLAB. I have the audio files A and B, B is recorded using a mic while playing audio file A. The length of file B is different from A. A does not always start from 0 second. My program is supposed to identify, file B from file A (giving a set of files A, X, Y, Z, etc. the program can figure out that the most correlation is A) Is there any existing resource or example for my problem? Or any suggestions for me to get start? Appropriate for your any comments and thanks!


Your problem is known as "robust audio fingerprinting", and cross-correlation is not useful for solving it:

  • Cross-correlation is computationally expensive for a full-length signal. Not to mention matching a collection of thousands (or even millions in industrial applications) of audio files.
  • Your recorded signal B will be different enough from A (additional room noise and reverberation, loss of low and high frequencies) that the raw waveforms will poorly match.

The most common approach for solving this problem on music signals (eg as used by Shazam) is to extract "landmarks" in the spectrogram, which are sharp increases in energy at a specific time/frequency point; and to hash these. Landmark extraction reduces the amount of data to process (from >10k samples per second to 50 or so data points per second), makes the extraction process robust to noise, and yields a data-representation fast to search since it can be quantized and hashed. Matlab implementation here. You have not mentioned what kind of content your audio files have; this technique might not always work for other types of content than music.

  • $\begingroup$ Thanks for your comments. For these days, I have tried to figure out how to modify the Metlab implementation for running in the Windows platform, and hope I can have a try for it. With the help in debug, I can deal with some problems, but finally I get the [D,SR] = readaudio(D); statement, which can no be found in any related download resources. Would you please help to give more ideas for how to deal with this? $\endgroup$ – user3175 Oct 31 '12 at 3:43
  • $\begingroup$ Try replacing it by waveread if you only need to open .wav files, or install this package: labrosa.ee.columbia.edu/matlab/audioread $\endgroup$ – pichenettes Oct 31 '12 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.