0

My goal is to be able to detect a specific noise that comes through the speakers of a PC using Python. That means the following, in pseudo code:

Sound is being played out of the speakers, by applications such as games for example, ny "audio to detect" sound happens, and I want to detect that, and take an action

The specific sound I want to detect can be found here.

If I break that down, i believe I need two things:

  1. A way to sample the audio that is being streamed to an audio device I actually have this bit working -- with the code found here : https://gist.github.com/renegadeandy/8424327f471f52a1b656bfb1c4ddf3e8 -- it is based off of sounddevice example plot - which I combine with an audio loopback device. This allows my code, to receive a callback with data that is played to the speakers.
  2. A way to compare each sample with my "audio to detect" sound file. The detection does not need to be exact - it just needs to be close. For example there will be lots of other noises happening at the same time, so its more being able to detect the footprint of the "audio to detect" within the audio stream of a variety of sounds.

Having investigated this, I found technologies mentioned in this post on SO and also this interesting article on Chromaprint. The Chromaprint article uses fpcalc to generate fingerprints, but because my "audio to detect" is around 1 - 2 seconds, fpcalc can't generate the fingerprint. I need something which works across smaller timespaces.

Can somebody help me with the problem #2 as detailed above?

How should I attempt this comparison (ideally with a little example), based upon my sampling using sounddevice in the audio_callback function. Many thanks in advance.

martineau
  • 119,623
  • 25
  • 170
  • 301
RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130
  • @szatmary Reposted with further progress -- please comment. – RenegadeAndy Jan 02 '20 at 23:47
  • @anil_m Reposted with progress, please comment :) – RenegadeAndy Jan 02 '20 at 23:47
  • This type of question has been asked before (and with little success, as you can tell): https://stackoverflow.com/questions/51224523/detect-matching-sounds-in-audio-stream - it's not really suitable to SO, since it basically comes down to asking for recommendations for libraries and frameworks, something that's primarily opinion-based. https://meta.stackoverflow.com/questions/251134/where-can-i-ask-about-finding-a-tool-library-or-favorite-off-site-resource – Grismar Jan 03 '20 at 00:03
  • Well - as it stands I don't know how to progress and I need a hand either way. If this isn't the site - point me at a better alternative. – RenegadeAndy Jan 03 '20 at 10:24
  • This sounds like a signal processing question. Probably you could ask it at https://dsp.stackexchange.com/? – Matthias Jan 03 '20 at 11:09
  • You might also try software recommendations, linked from the second link I posted. – Grismar Jan 04 '20 at 07:11
  • see also [Find sound effect inside an audio file](https://stackoverflow.com/questions/52572693/find-sound-effect-inside-an-audio-file) – milahu Jun 24 '23 at 08:42

0 Answers0