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:

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.

Perfect! Cool and many thanks. Best is to give you the link to my threa here on the forums;

The RPI4 version can be downloaded here;
or from github;

This could be the problem. I will check that and write you soon if this brings me closer to a runnable mycroft-system with working spotify.

Hey there, I have a similar setup and also ran into some problems using the spotify skill.

I installed raspotify as a client and first tried it with and without the --device hw:1,0 option to select the mic array for sound output, however i never got any sounds. Then I found this fix for a similar issue, related to different HW: https://github.com/dtcooper/raspotify/issues/40#issuecomment-346436761

Following the instructions, it removes the raspi internal sound card from the aplay -l list and in my case leaves only one option, the mic array. Doing so and removing the --device option from the raspotify config, then finally worked out for me.

I wonder if there is any downside of flashing the 48k Firmware? The sound output is pretty much subpar maxxed at 16k, especially if you want to want to hear radio or else.

I’ve seen mycroft setting config to 48000/44100 but only flashing the 16k Firmware. Did i miss something here?

To my knowledge the Mark-II dev team runs the Respeaker Mic Array with the 48k/1-channel firmware.

Yes it is, confirmed here

Can someone please explain to me the device name parameter of aplay/mpg123/…
aplay -Dplughw:ArrayUAC10,0

Doesn’t this mean the device with the device.id “ArrayUAC10” which is Card0?
so, basically the card which is fetched by

cat /proc/asound/cards

the same you find (DEV= ) on the output from aplay -L

    Playback/recording through the PulseAudio sound server
    ReSpeaker 4 Mic Array (UAC1.0), USB Audio
    Default Audio Device
    ReSpeaker 4 Mic Array (UAC1.0), USB Audio
    Front speakers

I refer specifically to the device number

I asked, because as far as i understand things right, with Pi+RespV2 (or other USB Audio for that matter) there is no default scenario where RespV2 is card0 (even if bcm* is blacklisted; as in my case) . And thus a chance to fail because of that. Am i wrong?