SOLVED Execute script (GPIO Relay) based on if sound is being played
Hi guys, I want to monitor if audio is being played, e.g:
And if any status contains
runningI want to execute a script (in my case turn on the amplifier). I want a simple solution and initially I thought it might be possible with udev or python or bash. Does any of you have a great and easy idea?
while sleep 1; do if grep -q 'RUNNING' '/proc/asound/card0/pcm0p/sub0/status'; then echo "Running!" else echo "Not Running!" fi done
this seems to work but the amplifier produces a too loud cracking sound when switching on, I have two spare relais und my MagicMirror, I will hook up the speakers to those and try again.