No sound in non-interactive mode
I have Slackware 15.0 kernel 5.15.145. I can run the following at the command line:
Code:
/usr/bin/mplayer /home/mfoley/sounds/tornado2.wav 2>&1 >> $HOME/testing Code:
TERM=vt100 /usr/bin/mplayer -softvol -volume 100 -ao alsa:device=hw=1.0 /home/mfoley/sounds/tornado2.wav 2>&1 >>$HOME/testing Code:
MPlayer 20210418-10.3.0 (C) 2000-2021 MPlayer Team Why do I get sound at the command line, but not when non-interacive? |
Probably pulse is not started or something like that. Run mplayer with one or several -v's for more information or master -msglevel option if you want to see only relevant messages.
|
The non-interactive process can't find the pulseaudio socket. It is in directory $XDG_RUNTIME_DIR/pulse, but XDG_RUNTIME_DIR is probably not defined in the non-interactive procmail process. Check what the value of $XDG_RUNTIME_DIR is in your interactive session and set it to the same value in front of your mplayer command.
|
Quote:
|
Quote:
But the directory is created when your session starts (you log in). And it's removed when the session ends. So, immediately after reboot the directory does not exist. Your mail sounds will probably work only while you are logged in. |
Quote:
What alternatives do I have to make this work? |
I had a similar problem. I use vnc remotely to access an fvwm screen started at my work computer and there is no session logged in then. So, no /run/user/$UID, because it was deleted when I logged out. I can't remember what the problem was that the missing $XDG_RUNTIME_DIR caused but I solved it by adding these lines in the beginning of ~/.bashrc
Code:
export XDG_CACHE_HOME=/dev/shm/$(whoami) (I haven't tried it with something like kde or xfce, so YMMV.) |
Quote:
So basically, XDG_RUNTIME_DIR is an arbitrary directory and could possibly be anthing at all, right? Even /tmp? Why would I need to create something in /dev/shm? |
Quote:
|
https://specifications.freedesktop.o...ec-latest.html tells this:
Quote:
|
Really!? This was not needed on Slackware 14.2 (kernel 4.4.301). That procmailrc script worked fine without me beling logged in. This is just the latest in numerous posts I've made at LQ going back years trying to get sound to work on a variety of Linux releases, including via KDE. It has been a constant pain. Fortunately, the LQ experts have always helped me solve the issue. If I installed Windows on this same system I'd have no problem with sound. Why is Windows sound hands-off plug-and-play and Linux is not? (rhetorical)
Oh well, I'll try the suggested /dev/shm idea ASAP and report back. |
All times are GMT -5. The time now is 06:58 PM. |