Is there a default program where I can check if my audio devices are in silent?
Edit: By silence, I mean that if there is something playing on that (not just activated or opened)
Something like this:
if [[ device0 is silent ]] ; then
radio $RANDOM
fi
Edit 2: What I'm trying to achieve is a script that plays radio and can keep playing when the player fails, e.g. if the internet connection goes down and the player didn't recovery, I will kill the player and start over again
Best Answer
If you're using PulseAudio (Gnome-based Linux distributions tend to use PulseAudio, you can check if one is running with
ps -C pulseaudio
) and you want to know whether some applications are sending any data to any "sink", you could do:Still with PulseAudio, if you want to check whether your sound output is muted, there might be simpler but you can get the "mute" status of the default "sink" using: