Comparing sound files if not completely identical

后端 未结 4 1237
执笔经年
执笔经年 2020-12-07 15:46

Is there any way to programatically compare two sound files to determine if they are identical, or nearly identical? These are not mp3 files and do not have any ID3 or othe

相关标签:
4条回答
  • 2020-12-07 16:35

    The wikipedia article on acoustic fingerprinting mentions a number of products, including the opensource libfooid. Basically you're looking at going into the frequency domain, taking rough levels over a relatively small number of bands (say 32), to give you a string that represents something like 25ms of sound, doing that for the whole file, then doing a fuzzing comparison of those strings for different files. It's fairly complex, but needs doing - comparing the actual samples won't get you anywhere as something as simple as a volume shift by a few percent will throw out the whole match.

    0 讨论(0)
  • 2020-12-07 16:38

    One thing that you could try that would give you a fairly decent fingerprint of the file is taking a Fourier transform and looking at the distribution of different frequencies present in the file. It's still very possible to make two very different sound files that have the same Fourier transform, but that's somewhat unlikely if your files are coming from a non-contrived source...

    0 讨论(0)
  • 2020-12-07 16:46

    The process for comparing a set of sounds for similarities is called Content Based Audio Indexing, Retrieval, and Fingerprinting in computer science research.

    One method of doing this is to:

    1) Run several bits of signal processing on each audio file to extract features, such as pitch over time, frequency spectrum, autocorrelation, dynamic range, transients, etc.

    2) Put all the features for each audio file into a multi-dimensional array and dump each multi-dimensional array into a database

    3) Use optimization techniques (such as gradient descent) to find the best match for a given audio file in your database of multi-dimensional data.

    The trick to making this work well is which features

    There are several projects that do stuff like this, including MusicBrainz, and EchoNest.

    Echonest has one of the simplest APIs I've seen in this space. Very easy to get started.

    P.S. No I do not work for Echonest, nor do I know anyone who works there.

    0 讨论(0)
  • 2020-12-07 16:49

    You could compare the two WAV files sample-by-sample, and calculate an average per-sample difference. To speed things up, you could use the same method but compare every 10th sample, or every 100th sample and come up with essentially the same value (two files that aren't the same or even close will have a huge per-sample average difference).

    0 讨论(0)
提交回复
热议问题