3

I have Polk Hampden speakers on my System76 desktop here. The sound is great, but if no sound plays for ~15 minutes, it goes into a power saving mode where no sound plays until there is about 8 seconds of audio again. So notifications, incoming calls etc. are all muted whether I want them to or not.

One guy on the polkaudio forums created a script on Windows that plays a 20Hz tone for 10 seconds every 15 minutes that seems to fix the problem.

So I created a 20 Hz .mp3 that lasts for 15 seconds (20Hz.mp3), I installed mpg123 and verified that this command works:

mpg123 ~/20Hz.mp3

What's the best way to execute this command in the background every 15 minutes?

Pablo Bianchi
  • 15,657
ebeyer
  • 31
  • I'm no expert on this, so likely this is not the 'best' way; yet I would possibly go for a shell script with a while loop in it, also with sleep 900. Then it would become possible to introduce this script as a service in systemd: https://askubuntu.com/a/1303177/1157519 That way probably it could be enabled / disabled as desired through systemctl. | Anyone reading this please feel free to educate me about what might be wrong with this. – Levente Jan 09 '21 at 20:47
  • @Levente I don't think there is anything wrong with this approach. – BeastOfCaerbannog Jan 09 '21 at 21:11

1 Answers1

6

If you can't reduce somehow those 8 seconds, you can generate a sound and play it periodically using user cron. There is no need of an external file.

  1. Install sox, Sound eXchange, the Swiss Army knife of audio manipulation:

    sudo apt install sox
    
  2. Edit your user cron table, process scheduling daemon:

    crontab -e
    
  3. Add this to play a 10 second 20 Hz (hence, barely hearable) tone every 15'.

    */15 * * * *   XDG_RUNTIME_DIR=/run/user/1000 /usr/bin/play -n synth 10 sin 20
    

    Where 1000 is your user ID, the output of id -u or $UID environment variable.

Pablo Bianchi
  • 15,657
  • 1
    This is awesome. I’m going to steal this idea and play a tone every 20 minutes to remind myself to stand up and stretch during the day. Thanks –  Jan 10 '21 at 02:40
  • 1
    @Matigo You can play a nice sound like play -q -n synth 2 pluck C5 or use this – Pablo Bianchi Jan 10 '21 at 07:30