You are not logged in.
Pages: 1
Topic closed
Hi all,
My Creative speakers turn off automatically after 10 minutes. This is because of the ErP Directive.
I thought a way to fix this (yeah, I want to turn the off whenever I want so I don't miss email beep notification, for example) would be to play a loud sound (10-20 Hz) every 10 mins.
I created a wav file with Audacity with some fade-in and fade-out to avoid a click noise and it should work.
My problem is when trying to set up the service and timer unit in systemd. I followed this article in the wiki, and at the end I have this two files in /etc/systemd/system
speakersawake.service (I didn't use my wav file just for testing purposes, I will change once I made this work)
[Unit]
Description=Plays a 10 Hz sound for 5 seconds
Wants=sound.target
After=sound.target
[Service]
User=iyan
ExecStart=/usr/bin/play -q /usr/share/sounds/Oxygen-Im-New-Mail.ogg
speakersawake.timer
[Unit]
Description=Run speakersawake every 10 minutes
[Timer]
OnStartupSec=20
OnUnitActiveSec=10min
[Install]
WantedBy=timers.target
After starting the timer with systemctl start speakersawake.timer, the service doesn't work and I get the following error
[iyan@master system]$ sudo systemctl status speakersawake.service
● speakersawake.service - Plays a 10 Hz sound for 5 seconds
Loaded: loaded (/etc/systemd/system/speakersawake.service; static; vendor preset: disabled)
Active: failed (Result: core-dump) since Wed 2020-06-17 12:45:24 CEST; 773ms ago
TriggeredBy: ● speakersawake.timer
Process: 57143 ExecStart=/usr/bin/play -q /usr/share/sounds/Oxygen-Im-New-Mail.ogg & (code=dumped, signal=FPE)
Main PID: 57143 (code=dumped, signal=FPE)
Jun 17 12:45:24 master systemd[1]: Started Plays a 10 Hz sound for 5 seconds.
Jun 17 12:45:24 master play[57143]: ALSA lib pcm_dmix.c:1090:(snd_pcm_dmix_open) unable to open slave
Jun 17 12:45:24 master systemd[1]: speakersawake.service: Main process exited, code=dumped, status=8/FPE
Jun 17 12:45:24 master systemd[1]: speakersawake.service: Failed with result 'core-dump'.
The error from play I can replicate if I try to run the same command as root user, but it works when I run it with my user. That is why I added the user option in [Service].
What am I missing?
Last edited by iyanmv (2020-06-17 12:53:06)
Offline
You want an User service/timer that is logically part of your normal session instead of a system wide one: https://wiki.archlinux.org/index.php/Systemd/User
In practice, copy both of these services to /etc/systemd/user/ or ~/.config/systemd/user/ depending on how far spread you want to be able to use them, remove the User= line since that will be implied by the user session, change sound.target for default.target as we can't depend on system services (though it's unlikely to even matter in this case) start the timer as your user with
systemctl --user enable speakersawake.timer --now
FWIW if you are using pulseaudio I'd suspect you could forgo this rain dance by uncommenting and setting
exit-idle-time=-1
in your /etc/pulse/daemon.conf that way pulse should never let go of the device.
Last edited by V1del (2020-06-17 11:14:16)
Offline
Thanks, first solution works! Now I will give it a try to the pulseaudio conf and see if it also works.
Edit: second solution doesn't work for me. But I'm happy with the timer. I cannot hear the sound, it keeps speakers alive and it doesn't affect sound if something else is playing.
Last edited by iyanmv (2020-06-17 13:17:19)
Offline
Disabling this line here in 'default.pa' works for me to keep the audio active all the time:
load-module module-suspend-on-idle
Besides editing the file in /etc, it's also possible to disable that line from the user's home with a config file like this:
$ cat ~/.config/pulse/default.pa
#!/usr/bin/pulseaudio -nF
.include /etc/pulse/default.pa
unload-module module-suspend-on-idle
Offline
Ahh yeah right, that was the module I was actually thinking of, and exit-idle-time seems to do something else entirely especially since the systemd integration.
Last edited by V1del (2020-06-17 15:52:35)
Offline
Disabling this line here in 'default.pa' works for me to keep the audio active all the time:
load-module module-suspend-on-idle
I've just tried that but it doesn't work for me. I guess this Creative speakers need some actual sound to stay on.
Offline
If you want to play a 20Hz sound for 5 seconds (and you have sox installed), you can just run:
/usr/bin/play -nq synth 5 sin 20
Offline
Technically they are running sox in the initial command already. While this will help in creating a silent pseudo sound and might thus align more closely with OPs goal, the thread is over 2 years old and as such I'll be closing it.
https://wiki.archlinux.org/title/Genera … bumping%22
Closing
Offline
Pages: 1
Topic closed