0
$\begingroup$

I have a long audio file (in wav) and a short audio file (in wav) that has been copied from the long file. Now I need to find the correct location where the short signal has been copied from. I tried to compare the sample data but for some reason (possibly resampling or introduction of short fades) it doesn't match up. What is a good and fast way to solve this?

$\endgroup$
  • $\begingroup$ Is there any remnant of the "short audio file" in the "long audio file"? How has the sample been removed? Is it simply cut and join or has there been an attempt to suppress the discontinuity? $\endgroup$ – A_A Oct 18 '18 at 12:31
  • $\begingroup$ The short audio file still exists in the long audio file. Sorry for the misunderstanding, it hasn't been cut out but rather a short segment has been copied. $\endgroup$ – jonen Oct 18 '18 at 12:35
1
$\begingroup$

If you are trying to find a signal inside another signal, Correlation is a useful technique. You will get a large peak anywhere the signals match. The easiest way to do it is to flip the shorter signal, such that samples 0 & N-1 are swapped, 1 & N-2, etc, then convolve the two signals. This should attenuate any effects of noise or edge condition resulting from resampling or fades, unless the phase data got mangled, in which case you’ll probably need something more sophisticated.

$\endgroup$
  • $\begingroup$ Thanks for the hint! I worked something out using numpy's correlate function. This answer was helpful $\endgroup$ – jonen Oct 18 '18 at 13:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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