Mycroft Community Forum

Picroft + rpi4 + Respeaker Mic Array v2.0 - Audio issues

Hey there. I would like to run 2 own build mycroft devcies and I had some issues.

My config is:
-Raspberry pi 4 - with 4GB
-Respeaker Mic Array v2.0 (https://www.seeedstudio.com/ReSpeaker-Mic-Array-v2-0.html)
-Picroft Unstable 2019-11-01 Buster image
-Mycroft-Core 19.8.3

The problem:
-When I play something from youtube-audio (YouTube Audio Skill - testing and feedback) or other sources, I got static noise. Listen to a sample here:
https://mega.nz/#!GopCQaYa!0OLWtoke3NopBjxva4tpsWhFzZ7f4RgW019hdhxT1eo

At the moment I use the 3.5 inch jack from my respeaker module. I read the this should be done, because of the nc feature.
Strange is that I am not able to set the default audio output to hdmi or the rpi-3.5 jack. When I do test in the wizard there is no sound.

Is the Respeaker Mic Array v2.0 not supported by picroft for the rpi4?

Greetings by suisat

Static noise can be an issue of resampling / samplerate.

Without any information about your sound configuration files, perhaps you could get some pointers from their mark2 enclosure code here;

Have a look at how they flash a certain ReSpeaker firmware and configure pulseaudio.

I use the default setup of the picroft unstable. So I just flashed the card and run the mycroft-setup. There I just choosed respeaker as default mic and output.

I try yesterday to get another setup, so I install the latest buster image for another rpi4. Then I install mycroft and I got the same results.

Perhaps you are right that my sound settings are wrong. I found this:


I guess I should use pulseaudio and change this samplerate. I thought alsa was the default audio-manager.
Did I need to change first from alsa -> pulseaudio?

Greetings by suisat

Looks like you are going to use this RPI4 only for this purpose so this is what I should do;

First, make sure that you use PulseAudio for audio playback. Edit your “/etc/mycroft/mycroft.conf” or “~/.mycroft/mycroft.conf” to add/change to these two lines;

"play_wav_cmdline": "paplay %1"
"play_mp3_cmdline": "mpg123 %1"

Pay good attention on the proper json format, using the comma’s where you should etc.

Then we can also force ALSA userspace to use PulseAudio as well by editting the “/etc/asound.conf” with the following content;

# Use PulseAudio by default
pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}

ctl.!default {
  type pulse
  fallback "sysdefault"
}

Now all sound setting are pushed towards PulseAudio. Now it is matter to setup PusleAudio properly similar as the Mark-2 enclosure;

Edit “/etc/pulse/daemon.conf” and at the bottom add the following content;

resample-method = ffmpeg
default-sample-format = s24le
default-sample-rate = 48000
alternate-sample-rate = 44100

Edit “/etc/pulse/default.pa” and at the bottom add the following content;

unload-module module-suspend-on-idle
unload-module module-role-cork
load-module module-role-ducking

That last file is most likely not needed for your issues, but if all works after this, we can easily enable ducking of audio later on.

Give it a go and let us know.

1 Like

Wow! It seems to solve my issue. You are genius! THX

The youtube-audio skill works finde and I can hear the mycroft voice. But spotify seems to be broken. I am not sure if this come from the audio-changes to pulseaudio or if this a issue by the spotify skill itself.

Can you explain what you mean with “enable ducking of audio later on.”?

Greetings by suisat

TTS is now duckable. Have a look at my mycroft.conf

Within the TTS section you can configure “pulse_duck = true”

With that enabled. Start a playback with the YouTube skill. During playback say “hey Mycroft”. The playback mutes for it to listen to your command. Ask about for example the weather. Playback continues and than during the TTS the music volume get’s reduced.

I will check this duck feature, sound like the feature on google home or alexa.

Could there be a reason why my spotify give me no sound output?

I don’t have Spotify, but from the top of my head, reading about it here and there in relation to Mycroft, you need a “spotify connect” type of client.

I believe that client uses “Libao” for it’s playback, which you need to tell to use PulseAudio as well.

But that is as far as I followed, run into, read about Spotify.

Sadly I still found no solution yet.

I am really unsure if this is a problem with raspotify/librespot or with mycroft for the rpi4.
@andlo he had some issues with the google-AIY and setting the volume but. I can change the volume.
Here is somebody changing the /etc/asound.conf but this does not change ynthing on my picroft.

Some other users had some issues after playing 5 songs with raspotify here. I create the .pulse/client.conf without any success.

@andlo or @forslund any tips or tricks, how I can enable the spotify skill to play on my configuration? I would be very thankfull.

Looking at the last link, am I correct that Raspotify/Librespot is running as a seperate user?

With the asound config, forcing to forward all stuff to PulseAudio, there should not be any tweaking required for those systems, however if the program is running under a different user that user should be added to the pulse group to be able to spawn a connection.

Or you should run PulseAudio in systemwide deamon modus and allow anonymous acces to either the bus, tcp or both.

@suisat Could I ask you for a favour? As you have a RPI4 and the ReSpeaker, I wonder if you have a spare SDcard and would like to test my RPi4 build of MycroftOS?

Coded it “blind” without access to a RPi4, so fair big change it doesn’t even boot, but just wanted to know.