Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2934  / 3 Years ago, mon, may 24, 2021, 11:28:35

I have set up a script, which executes an mplayer command, in order to play audio in crontab. It will be executed in a special set time, but this script can not play audio when ncmpcpp (a front-end for mpd, aka. Music Player Daemon) is playing music. But this script can play audio when I execute it from terminal like this:



sh bin/alarm.sh   


I try to get output from either crontab or script, but to no avail. I guess some setting in ncmpcpp or mplayer is wrong, or mpd is using same daemon with crontab's daemon.




  • Anyway, I can not find out the solution. If you know, please help me.


More From » scripts

 Answers
7

The problem seems to be that mpd runs under user mpd per default (as a system daemon) and is thus unable to join your sessions' pulseaudio mixer, therefore it hogs the sound card output via alsa or even oss. In my answer, I assume that you are logged in and that the crontab is yours and not the system crontab.



MPD



Depending on your priorities, you have a lot of options that mostly circle around the idea teaching mpd to not hog the sound and use pulseaudio instead. See the mpd wiki.



mplayer



You can configure mplayer to default to pulseaudio by placing a line ao=pulse in ~/.mplayer/config but pulseaudio should pick it up nicely with its alsa plugin.


[#43240] Tuesday, May 25, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ithriv

Total Points: 46
Total Questions: 115
Total Answers: 96

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago
ithriv questions
Tue, Mar 14, 23, 14:31, 1 Year ago
Wed, Oct 5, 22, 02:59, 2 Years ago
Fri, Mar 11, 22, 10:12, 2 Years ago
Thu, May 11, 23, 10:55, 1 Year ago
Sun, Sep 26, 21, 06:47, 3 Years ago
;