I'm trying to execute shell-commands in emacs which play sounds or otherwise involve audio output, but I'm not having much luck.
When I execute:
(shell-command
(concat "espeak -v mb-en1 -k5 -s150 " "'" "hello" " " "world" "'" " --stdout|paplay"))
No audio output is generated and I find the following message:
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
1 (#o1, #x1, ?\C-a)
A different though related problem, if I try:
(shell-command
(concat "mplayer -really-quiet " "/usr/share/sounds/speech-dispatcher/test.wav" " 2> /dev/null"))
Again, I don't actually get any audio output and I find the message:
(Shell command succeeded with no output)
0 (#o0, #x0, ?\C-@)
Both commands work as expected from the actual terminal shell (i.e. they produce audio output).
Edit: Ok, this seems to be part of a more general problem. On my home computer I finally got everything to work by allowing greater permissions to pulse-audio. However, now on my office computer, I'm having trouble getting notify-send
to work when issued in shell-command
in Emacs. I'm getting the same odd 0 (#o0, #x0, ?\C-@)
message when I try to do this.
2>/dev/null
from your mplayer command, so that you can see whether there are errors.systemd
, and running as a process owned by my username. I then launched anemacsclient
instance. The errors from mplayer had to do with connecting to ALSA.