Mycroft + custom pulseaudio installation = trouble Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
dodecadog
Posts: 2
Joined: Thu Aug 05, 2021 12:19 pm

Mycroft + custom pulseaudio installation = trouble

Post by dodecadog »

Hi everyone,

I'm struggling to set up Mycroft on top of a custom audio configuration required for my bluetooth speaker that has an embedded microphone. I was hoping someone savvy could help me debug the situation. I've gotten as far as the audio test working just fine when run as dietpi (it can record sound and play it back, detecting pulse as an audio device). But, weirdly, outside the audiotest, Mycroft can't hear me and won't produce any sound. More info below.

Device: Raspberry Pi 3B

Why I (probably) need a different version of pulseaudio than supplied in the official repos: I'm no expert in hardware, but after following multiple tutorials in hopes of getting my bluetooth speaker/mic combo (essentially a headset) working with my Raspberry 3B, I have come to the conclusion that the pulseaudio version in the repos is too old to support my bluetooth card in handsfree_head_unit mode, with only a2dp_sink profile being available (i.e. speaker works but microphone doesn't).

Steps leading up to the issue:
(following some trial and error, the remains of which I hopefully cleaned up)
1.

Code: Select all

sudo apt install pulseaudio pulseaudio-utils
, to make apt mark these packages as installed;
2.

Code: Select all

sudo apt-mark hold pulseaudio pulseaudio-utils
, to prevent apt overwriting what I did next;
3. Install the latest pulseaudio from source as per https://www.freedesktop.org/wiki/Softwa ... dioFromGit, overwriting the official pulseaudio that was already installed;
4. Confirm that parecord and paplay work with my bluetooth device, i.e. both speaker and microphone work after I did

Code: Select all

pactl load-module module-bluetooth-discover
pacmd set-card-profile [card] handsfree_head_unit
5. Install Mycroft via dietpi-software as per https://dietpi.com/docs/software/hardwa ... mycroft-ai, following the "Interactive Install" and "Initial Setup" sections. Pairing is successful, although no sound is heard during the whole process.

What I expected to happen: I should be able to use Mycroft with my bluetooth speaker/mic, given that pulseaudio works.
What happens: Mycroft command line works nicely (I tried the "tell me a joke" and "what's my ip?" skills), but Mycroft produces no sound and can't hear me. The microphone level in the bottom right corner of the debug screen does not change.

What I tried: I ran

Code: Select all

mycroft-start audiotest -l
and this is the part I don't get: the audiotest does work as expected, I can record my voice and hear it played back with the bluetooth device. The Mycroft Audio Troubleshooting section on their website (https://mycroft-ai.gitbook.io/docs/usin ... leshooting) claims "If the test is successful and you hear the recorded audio back, it should be possible for Mycroft to use the intended microphone.".

What I think is going on: There's something wrong with permissions and/or the pulseaudio setup between the users dietpi and mycroft:
User dietpi: Audiotest works when run as dietpi, detecting the audio devices "default" and "pulse"; paplay, aplay, parecord and arecord all work; the bluetooth headset appears under "pacmd list". But when I try to run mycroft-start debug as dietpi, it retries forever to find "Messagebus websocket". If I could figure out this messagebus thing, Mycroft might work.
User mycroft: Audiotest (

Code: Select all

sudo -u mycroft ./mycroft-start audiotest -l
) detects the "default" and "pulse" audio devices, but I can hear nothing played back. None of parecord, arecord. parecord, arecord work when run as mycroft. "pacmd list" does not show my bluetooth device when run as mycroft. If I could fix pulseaudio for user mycroft, that should also solve the issue.

I don't really know where to go next. I'm happy to provide any logs or config files or clarifications that are needed to debug this. Thanks in advance! (and please don't advise me to just buy a USB microphone, where's the fun in that? :p)
dodecadog
Posts: 2
Joined: Thu Aug 05, 2021 12:19 pm

Re: Mycroft + custom pulseaudio installation = trouble

Post by dodecadog »

I was able to fix this by uninstalling Mycroft through dietpi-software and installing from source (https://github.com/mycroftai). Previously this had not worked, and I guess it's having pulseaudio marked as installed by apt that did the trick, or the fact that I cloned the repo to my home directory instead of a custom location. Now Mycroft speaks out of the box and can hear me, although I'll have to troubleshoot wake word detection.
Post Reply