Python Forum
Detecting Windows System Sounds? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Detecting Windows System Sounds? (/thread-7750.html)



Detecting Windows System Sounds? - crash2720 - Jan-23-2018

I've written a script that uses pyautogui to interact with another program on my computer, but I'd like to build in some failsafes into it to deal with errors that may pop up should they occur. The error messages that may come up all vary between each other and the only thing that remains consistent is that the "C:\Windows\media\Windows Background.wav" file is played when an error does happen. So I'm hoping to write into the script something that either detects when the wav file is accessed/ used by another program, or detect the output from the speakers to know when the error sound is played. Pyaudio and audioread seemed close to what I need, but neither seemed to have a way to store the sound, detect it, and trigger an event when it does occur.


RE: Detecting Windows System Sounds? - Larz60+ - Jan-23-2018

for Pyaudio, see: https://stackoverflow.com/questions/17657103/how-to-play-wav-file-in-python

If that doesn't work, Perhaps try another wav package?
see: https://pypi.python.org/pypi?%3Aaction=search&term=wav&submit=search