Detect if sound is playing something in another application

I want to detect when sound is being played on the computer a processing sketch is running on.

Audio playback starts in browser, processing sketch executes action - for example a keyboard shortcut to pause a local video player. When audio stops, keyboard shortcut is executed again to unpause video player.

Connect your headphone and mic :stuck_out_tongue:
In windows there also is software to do that.

There is stereo mix, but is there any code examples of how to detect sound on stereomix? The problem with that is if I was playing a playlist for example, once one item stopped to go to the next item it would trigger the pause command. So it would be best if it were to listen to a specific application like firefox.

I did get stereomix working with a few lines of code and minim library.

But as I mentioned, this is a little too rough for my use case, which is auto play/pause local media when viewing content in a browser. If I only can listen to all audio sources, I have no way to know if I start playing something in the browser while I’m playing local media because they are mixed in the same input.

I’ve figured out how to accomplish this on my own computer, but only with the help of a couple external applications/drivers for audio routing. I’m hoping to get the input directly in processing without needing to install any audio drivers and using audio routing apps.