Locate one audio clip within another (needle/haystack)

I have an audio processing challenge that I’m beginning to think is impossible to automate… here it is:

Let’s say I have 100 audio clips (the “haystack” clips) that all contain the same sound effect (the “needle” clip), which is very distinct and easily recognized. I want to split the haystacks based on the position of the needle. How can I precisely locate (down to the millisecond) the needle in the haystack, preferably through automated means (command line or scripting)?

If audio tracks were text strings, what I’d be looking for is a function like strpos() or indexOf(), but with a tolerance parameter for imperfect matches.

After many Google searches I’ve come up empty. Any ideas?

And if wishes were horses, beggars would ride … :slight_smile:

I suspect there is a big reason why your googling yielded naught - and that’s because it can’t be done, not without a super-computer and a lot of cute, tricky coding anyway.


Possible lead …

Plugins like Kn0ck0ut use the spectral subtraction method … http://www.freewebs.com/st3pan0va/
if the needle sound is spectrally subtracted from the haystack sound, the greatest reduction in the haystack amplitude will occur when the needle sound is aligned with the needle in the haystack.

This would mean applying something like Kn0ck0ut repeatedly, [million x], which could be very time consuming.