Mycroft Community Forum

No audio devices detected (pulseaudio trouble)

Hello,

I have just installed Mycroft on my Raspberry Pi 3B and am experiencing audio difficulties as described below.

What type of Mycroft device: Raspberry Pi 3B running Dietpi (which is based on Raspberry Pi OS 32-bit Lite).

What steps you took leading up to the issue:
Background: I’ve been playing around with pulseaudio to get it working with my bluetooth speaker that has a built-in microphone and essentially acts as a headset. I got it working by apt-removing the pulseaudio version supplied from raspberry.org, and compiling the latest pulseaudio from source. Most likely this is causing problems with mycroft, but reverting to the pulseaudio package from the official repositories is not an option as my bluetooth speaker/microphone combo would not be supported at all.
Installation of Mycroft: I followed the “Getting Started” instructions from the Mycroft-core GitHub, but I modified the dev_setup.sh install script to prevent the installation of the official pulseaudio package. I manually removed all occurrences of pulseaudio from the install script because, despite running “apt-mark hold pulseaudio” to prevent its installation by the package manager, apt informed me during the running of dev_setup.sh that this held-back package would be changed and installed anyway if I continued. Installation then proceeded smoothly.
Running Mycroft: I ran “start_mycroft.sh debug” and Mycroft spoke through the bluetooth speaker out of the box, informing me of the pairing code which I successfully registered with my account. Mycroft did not seem to hear me speak, but I assumed it was just struggling to start up for the first time, as the voice lagged several seconds behind the information on the command line. I rebooted the machine because it seemed stuck on "please wait a moment as I finish booting up” while downloading its skills. I ran start_mycroft.sh again and it looks ready to go; for example, I can ask it for jokes and for my IP address on the command line. However, both audio input and output have stopped working.

What happened, compared to what you expected to happen:
Mycroft seems to have lost connection to pulseaudio completely, despite speaking just fine immediately after installation as I paired my device. I have verified that parecord and paplay function correctly, recording and playing back audio through my bluetooth speaker/mic. It’s perhaps relevant that “aplay -l” does not detect the bluetooth speaker, but I assumed mycroft would work as long as pulseaudio works. I can see that other people on this forum have had luck with bluealsa and bluetooth speakers, but I’d rather not discard a working pulseaudio configuration before ruling out other causes.

When I do “./mycroft-start audiotest -l” from the bin folder of the git repo, it is unable to find any audio devices:

audiotest

./mycroft-start audiotest -l
Already up to date.
Initializing…
Starting audiotest
Initializing…
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
====================== Audio Devices ======================
Index Device Name

========================== Info ===========================
Input device: Default device @ Sample rate: 16000 Hz
Playback commandline: paplay WAV_FILE

===========================================================
== STARTING TO RECORD, MAKE SOME NOISE! ==

Traceback (most recent call last):
File “/usr/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/dietpi/git/mycroft-core/mycroft/util/audio_test.py”, line 137, in
main()
File “/home/dietpi/git/mycroft-core/mycroft/util/audio_test.py”, line 124, in main
record(args.filename, args.duration)
File “/home/dietpi/git/mycroft-core/mycroft/util/audio_test.py”, line 67, in record
with mic as source:
File “/home/dietpi/git/mycroft-core/mycroft/client/speech/mic.py”, line 140, in enter
return self._start()
File “/home/dietpi/git/mycroft-core/mycroft/client/speech/mic.py”, line 151, in _start
input=True, # stream is an input stream
File “/home/dietpi/git/mycroft-core/.venv/lib/python3.7/site-packages/pyaudio.py”, line 750, in open
stream = Stream(self, *args, **kwargs)
File “/home/dietpi/git/mycroft-core/.venv/lib/python3.7/site-packages/pyaudio.py”, line 441, in init
self._stream = pa.open(**arguments)
OSError: [Errno -9996] Invalid input device (no default output device)

Update: I tracked down “OSError: [Errno -9996] Invalid input device (no default output device)” as being related to the snd-aloop module. After doing “sudo modprobe snd-aloop”, a couple of audio devices are detected. Still, no luck with the bluetooth speaker.

audiotest

./mycroft-start audiotest -l
Already up to date.
Initializing…
Starting audiotest
Initializing…
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.front.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM front
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround51.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround51.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround21
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround40.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround40
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround51.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround41
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround51.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround50
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround51.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround51
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_headpho.pcm.surround71.0:CARD=0’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM surround71
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
====================== Audio Devices ======================
Index Device Name
1: Loopback: PCM (hw:1,0)
2: Loopback: PCM (hw:1,1)

========================== Info ===========================
Input device: Default device @ Sample rate: 16000 Hz
Playback commandline: paplay WAV_FILE

===========================================================
== STARTING TO RECORD, MAKE SOME NOISE! ==

===========================================================
== DONE RECORDING, PLAYING BACK… ==

Well, if anyone stumbles upon this in the future, I opened a similar topic on the DietPi forum because the issue seems to stem from the users and permissions associated with the DietPi installation: Mycroft + custom pulseaudio installation = trouble - DietPi

Have a look at this post;

I believe the asound.conf will be enough to fix your issue

Is mycroft running? What is the output of ‘sudo service mycroft status’?

If not, try a ‘sudo service mycroft start’, then what is the output of ‘journalctl -xe’?

-Mike M

Hi both,

Thank you for your replies. I actually got it working just now.

I redid the entire installation, making sure to clone mycroft-core to my home directory instead of a custom folder. I also re-installed the (troublesome) old version of pulseaudio from the official repos before overwriting it with the newest pulseaudio, so that my package manager can see the package as installed and not complain. Mycroft can hear me and speak back through my bluetooth device, so problem solved.

1 Like