I use mopidy with jasper like to control my music with my voice.
It’s work but when I start my command and the music start. my jasper like must play a litle song but my jasper like because :
play FAIL formats: can't open output file `default': snd_pcm_open error: Device or resource busy
ERROR: play command failed
My all log is
pi@raspberrypi:~/jarvis $ ./jarvis.sh
jarvis: Hi
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Audio device hw:0 cannot be acquired...
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
[jack.c:252] error: Failed to open jack client: 0x11
[jack.c:58] warning: FIXME: One needs to wait or write some silence here to prevent the last bits of audio to vanish out of the ringbuffer.
tts_engines/google/main.sh: line 38: 1856 Segmentation fault mpg123 -q $audio_file
jarvis: Waiting to hear 'jarvis'
Tymoti: play FAIL formats: can't open output file `default': snd_pcm_open error: Device or resource busy
ERROR: play command failed
It’s a alsa problem no ?
pi@raspberrypi:~/jarvis $ sudo fuser -fv /dev/snd/* /dev/dsp*
Specified filename /dev/dsp* does not exist.
USER PID ACCESS COMMAND
/dev/snd/controlC2: pi 784 F.... lxpanel
/dev/snd/pcmC1D0p: root 526 F.... mopidy
You don’t say what sound system you are using, is it alsa, pulseaudio or Jack(!).
Assuming you are using alsa:
Only one process may grab a hardware alsa device at a time. If mopidy has opened the alsa device (by playing a song) then jarvis cannot then also use the device. And vice versa.
The thread you linked to suggests defining an alsa dmix plugin in /etc/asound.conf which will allow multiple processes to use the audio device at the same time. I would guess this is the way to go, and then just make it the default device.
Mopidy does not have an mpd.conf file as this is a configuration file for mpd. Mopidy configuration is done in mopidy.conf and the location depends on if you are running Mopidy as a service or not. See the docs for more details.
Maybe it’s the same problem I had with AirPlay: Most Mopidy-Interfaces don’t have a Stop Button, only a Pause. And this keeps the output device busy. That’s the reason I use Mopidy-Mobile.
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
play FAIL formats: can't open output file `default': snd_pcm_open error: Device or resource busy
ERROR: play command failed
And why I start one music with mpg123 and start my jasper like, there are no problem with two song together.
But when I start mopidy (music launched) and would like to start another song with mpg123. I have a problem ?
mpg123 flume.mp3
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jackdmp 1.9.10
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2014 Grame.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
JACK server starting in realtime mode with priority 10
self-connect-mode is "Don't restrict self connect requests"
Failed to connect to session bus for device reservation Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Audio device hw:0 cannot be acquired...
Cannot initialize driver
JackServer::Open failed with -1
Failed to open server
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
I don’t understand, why pcm.!default doesn’t use many times (dmix plugin) with mopidy.
Maybe because one is in daemon and the other no ?
Since you have not specified if it’s a daemon or not we cannot know.
For sanity, I would suggest you copy your ~/.asoundrc file to /etc/asound.conf and then remove ~/.asoundrc. Then all users on your system will use the same configuration will sill see the same default audio device.
Did you setup a /root/.asoundrc file?
It seems your jasper/jack configuration tries to grab the alsa hw device. This not possible while other pcm you defined are using the device.
Also you can specify the alsa device mopedy should use in mopedy.conf like so: