问题
I have two sound files, and one is simply an excerpt from the larger file, and should be nearly identical for that part
How might I compare the two sound files so as to find out how far into the larger one the smaller one starts playing?
This would preferably be a linux terminal command, for use with bash
回答1:
If they are .WAV files and one was created directly from the other, then there should be a section which is byte for byte identical, and a good diff tool can find it for you. If they are mp3s created with the same compressor from the same source, you can decompress them and the same thing holds.
Anything else and it gets really tricky. You could try converting both to the same raw WAV format, and then do some fuzzy matching (like sliding a section of one against the other and finding the place with the least RSS of the differences).
Or you can try doing it in the frequency domain by breaking the files into small chunks, doing FFTs on them, and looking for a series of matching primary frequencies.
I'm not really convinced either would work well. I'd try the time domain method first.
来源:https://stackoverflow.com/questions/7921381/finding-one-sound-file-inside-of-another