I am looking for a tool which is able to recognize a specific sound within a mp3-file and tell me, where it starts. I have a reference-file (about three seconds long) and I want to know: Is there such a sound within the mp3 - and if so: at which sample/second does it start?

I could imagine some pseudo-code for this but I do not know if there is already a solution for this. Does anyone know such tool?


1 Answer 1


Are you looking for exactly the same sound or sounds like that sound - I will lay odds that it is the later.

If you are looking for an exact match, i.e. the same frequencies at the same volume with the same duration, i.e. if you are trying to find out where a snippet came from, then the pseudo-code is easy:

  1. Convert both MP3 files to Wave files, (so as to remove the compression).
  2. Convert both Wave files into a sequence of numbers
  3. Look for the sequence in the first file within the second file

Since your sample is 3 seconds long I would suggest using multiple files 4 seconds long starting each second of the recording to allow you to pin down the start time.

However if you want sounds like or recognizable things get a lot more complex - as Les Dawson proved over and over you can recognize some music even when you can also tell that every note is just wrong, listen to https://www.youtube.com/watch?v=9nNGlaiVypU.

You need to sample both set of sounds, normalize the volumes, use Fast Fourier Transforms to split things into frequency buckets, decide which duration are near enough and score the similarity.

  • 1
    As you already guessed: the reference sounds the same but may varies in amplitude in comparison to the clip i want to match it with. So a simple check of the sequences of numbers would fail, I guess. Thank you for the hint about Fast Fourier Transforms - I will mess around with that. And also thank you for the Les-Dawson-Video. I have not seen it before.
    – Prismex
    Jul 16, 2019 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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