Finding one sound file inside of another

♀尐吖头ヾ 提交于 2019-12-10 19:56:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!