# download python script
wget https://gist.githubusercontent.com/davcri/35074eda17caf24e0d8269edba58192c/raw/514e8c027c46b2f98e6674beb62ec4b3e1b1a346/generate-sine-tone-wav.py
# generate sine tone
python generate-sine-tone-wav.py
# move audio file
mv sine-wave-20hz.wav ~/.local/sine-wave-20hz.wav
Create unit file:
sudo nano /etc/systemd/user/play-audio.service
Copy paste this:
[Unit]
Description=Play low freq and low volume audio to prevent speakers suspend
[Service]
Type=oneshot
ExecStart=paplay /home/dc/.local/output.wav # DOUBLE CHECK THE PATH! Here I used my username "dc"
Create systemd timer:
sudo nano /etc/systemd/user/play-audio.timer
Copy paste this:
[Unit]
Description=Run play-audio service unit
[Timer]
OnBootSec=1min
OnUnitActiveSec=5min
[Install]
WantedBy=timers.target
Finally activate the timer:
systemctl --user enable play-audio.timer
# to check if the timer works:
watch -n 1 journalctl --user -u play-audio