Mycroft ans sound (output and input) drives me crazy

Hi guys,

I have a rpi3 with the google voice hat wich works nicely. But for playing around and making my own skills I have a rpi4 with a Seeed 2 mic hat. However, after installing picroft, following the instructions from Seeed how the install the hat, everything worked fine until I powered off the rpi. And of course I followed the mycroft audio problems troubleshooter.
Since that moment, I’ve tried to get everything to work again. But no go.
Sometimes “aplay ” works, sometimes not. Then I have to use “aplay -D hw:0,0 wich might work and 5 minutes later it doesn’t . If it works ( just using “aplay ”), when I say “hey mycroft”, the client tells me that it got the wakeword and plays the “start_listening wave” but that takes some 20 seconds without a sound. Then it starts to record but still no output .
I’ve tried So I searched the web for solutions.
I’ve tried a lot of things ( as people suggested on the internet) : setting the default sink, default source, changing asound.conf,, /usr/share/alsa/alsa.conf, /home/xxx/.asoundrc , /etc/pulse/daemon.conf and whatever was suggested but nothing helped.
As I’m not a rpi guru this is driving me crazy. It seems that no one is able to give a hint about the real solution.
I do see errors like
“No audio service to restore volume of” in the audio.log,
alsa-sink-bcm2835-i2s-wm8960-hifi wm8960-hifi-0] alsa-sink.c: Resume failed, couldn’t restore original sample settings” in the syslog and daemon.log ( 2265955 lines !!! )
Alsamixer never seems to remember my settings ( even after doing a store ).
So sometimes I get everything working as it should but after poweroff and startup, it won’t work. That’s why I hope that somebody is able to tell me how to get it working.
What should be entered in every conf file. It has taking me already 4 days to try and find out why it’s not working and as somebody said: the time you need to get it fixed should be used for relaxing and using the system what it is meant for and not for troubleshooting.

So I’m about to throw the pi out of the window and say goodbye to mycroft.



Hi Frank and everyone else that uses a wm8960 soundcard on a pi here is my odyssee, but now it is working.

So the problem with the “Resume failed, couldn’t restore original sample settings” has come to me after searching for nearly a month (yes i can be very stubborn). The way to find the root cause was to set pulseaudio to log-level debug. There you can see that the soundcard doesn’t support the 48000 Hz default sample rate, which is used by the wav file of the start_listening.wav and the mp3 return of the tts.

The solution here is to first set in the pulseaudio config (/etc/pulse/daemon.conf) the following values

default-sample-format = s32le
default-sample-rate = 44100

then you have to override the following settings in the mycroft-config.

“play_wav_cmdline”: “aplay -r 44100 %1”,
“play_mp3_cmdline”: “mpg123 -r 44100 %1”,

And final but not least you have to convert the start_listening.wav (it is the beep tone after wake word detection) to sample rate 44100. This is best done with ffmpeg like this

ffmpeg -i /home/pi/mycroft-core/mycroft/res/snd/start_listening.wav -ar 44100 /home/pi/mycroft-core/mycroft/res/snd/start_listening2.wav

and of course set the start_listening2.wav as sound to play.

“sounds”: {
“start_listening”: “snd/start_listening2.wav”,
“end_listening”: “snd/end_listening.wav”,
“acknowledge”: “snd/acknowledge.mp3”

Then everything should work at least it does for me.

Now we can discuss if this is an error in pulseaudio, mycroft or the wm8960.

PS: If you have a soundcard with a different sample then 44100 you need this of course