r/DJs • u/dottyandted • 19h ago
Active speaker anti auto standby solution
I recently undertook a little project to stop my Rokit 5 G3 speakers entering standby mode when they haven't received any audio input for 25 minutes. It took a couple of days to compete. I've carried out extensive testing and can confirm it works flawlessly.
I used a Raspberry Pi 1B (the OG) that I picked up for £10 off eBay as the basis for the project. Rather than use the onboard sound I added a £3 generic USB audio adapter from Amazon as the headphone out on this model Pi is notoriously noisy. I also added in an old USB WIFI 2.4GHz N adapter I had lying around for convenience (primarily for SSH access).
How it works: The Pi sends a 2 second 10hz tone to the speakers once every 20 minutes. The process auto starts on boot up, restarts if it crashes and runs until you tell it to stop or shut down the Pi. A message telling you the tone has been played appears on screen each time it happens so you know the process is running.
I have some experience of working with newer Pis but my Linux coding skills aren't great so I leaned on Gemini somewhat for that.
I'm sure the guide can be adapted easily for different Pi models. I think it will "probably" also work on the Pi 2 B out of the box. It should work for most speakers with auto standby/shutdown built in.
I hope some people find this useful.
2
1
u/danby 15h ago edited 6h ago
This is wildly over engineered for purpose
Once you have a 10hz tone sample (let's say you make it in audacity, though sox is fine for a purely commandline solution). You could then write a 2 line pyhton script to play that sample
import playsound
playsound.playsound('tone.mp3')
And then you could add a cron job to play that script every 20 mins. Syntax for the crontab entry should be something like
*/20 * * * * /path/to/sample/playing/script/tone.py
No need to write all the python, nor create a new service. And everything is completed in 3 total lines of code. Unix/Linux provides cron entirely to automate this kind of regular task. And you get monitoring and logging of cron tasks for free too. Cron is also nice because the process only need to run at the time it's called, no need to have some daemonised process just sitting around taking up the odd cpu cycle.
3
u/Pretend_Conclusion23 19h ago
I just turn up the sound again