for a raspberry pi, or debian-based device connected by 3.5mm jack.
tested on dietpi distro running on Rpi B gen 1 with shairplay-sync
From the root user home folder (~/ when logged in to root)
wget https://s.put.re/w8s9Lk5A.wav -O /root/15tone.wav
nano playsoundifnotplaying.sh
copy paste the follow script:
#!/bin/bash
if grep -q RUNNING /proc/asound/card*/*p/*/status 2>&1; then
echo "Audio playing, not doing anything"
else
echo "No audio playing, playing silent tone"
aplay /root/15tone.wav
fi
ctrl:x to save and exit
then make the script executable:
chmod +x ./playsoundifnotplaying.sh
you can test the script by running ./playsoundifnotplaying.sh
open crontab
crontab -e
add the line:
*/15 * * * * /bin/bash /root/playsoundifnotplaying.sh >/dev/null 2>&1
ctrl:x to save and exit