No Playback or Mic Input but all audio tests succeed

Yes I did,
I use systemd for Mycroft:

[Unit]
Description=Mycroft AI
After=pulseaudio.service
[Service]
User=pi
WorkingDirectory=/home/pi/
ExecStart=/home/pi/mycroft-core/bin/mycroft-start all
ExecStop=/home/pi/mycroft-core/bin/mycroft-stop
Type=forking
Restart=no
[Install]
WantedBy=multi-user.target

If I watch the output of htop I see that all mycroft processes are run by ‘pi’ as well as pulseaudio…

since you run PIXEL, i wonder if pavucontrol could get you on the right track? (troubleshooting wise)

Which settings should I set via pavucontrol? I already have it installed, but didn’t change anything… I also experienced a strange behaviour while using it:
If I open it from the desktop my mouse and keyboard freeze and I need to set things up via VNC and close the window - only then mouse and keyboard are working again… Pulseaudio is really messing things up but I don’t know how to change that…

i was just fishing for an error message from pavu.

Is there a sound output in this environment?

How about tossing pulseaudio alltogether to be reinstalled through the mycroft requirements (assuming pa was already set up before mycroft)

Yes I have sound output. I can use paplay for instance to play some .wav files. pavucontrol also shows audio level for input and output devices.

What do you think is the best method to reinstall pulseaudio through mycroft? I already reinstalled it completely using apt - there was no effect in doing so…

is this a clean installation (mycroft), or do you have additional skills set up?

This is a clean installation. I only paired the device - I did not set up additional skills

Yeah (looked it up), the mplayer is used since 2018 from core. Why isn’t the py_mplayer not in the requirements.txt and what is/was it used for? If discontinued, the whole shebang should be tossed.

Anyways, i don’t know how the new Raspberry OS is shipped. Was pulseaudio still on there as Mycroft got installed? (if not, the whole process would be completely unnecessary)

grasping for straws here, but what is ls -la ~/.config/pulse/ saying?

wait a sec. Did you just say “paplay” is working? what is ~/.mycroft/mycroft.conf or /etc/mycroft/mycroft.conf using? (and is mpg123 playing mp3 files?)

pi@raspberrypi:/var/log $ ls -la ~/.config/pulse/
insgesamt 68
drwx------ 2 pi pi 4096 Sep 7 08:55 .
drwx------ 19 pi pi 4096 Sep 6 21:44 …
-rw------- 1 pi pi 20480 Sep 6 12:14 9f3227c8b0614f26b7a19283224cfdf9-card-database.tdb
-rw------- 1 pi pi 1 Sep 7 08:55 9f3227c8b0614f26b7a19283224cfdf9-default-sink
-rw------- 1 pi pi 1 Sep 7 08:55 9f3227c8b0614f26b7a19283224cfdf9-default-source
-rw------- 1 pi pi 16384 Sep 6 12:57 9f3227c8b0614f26b7a19283224cfdf9-device-volumes.tdb
lrwxrwxrwx 1 pi pi 23 Sep 7 08:55 9f3227c8b0614f26b7a19283224cfdf9-runtime -> /tmp/pulse-2L9K88eMlGn7
-rw------- 1 pi pi 12288 Sep 7 09:07 9f3227c8b0614f26b7a19283224cfdf9-stream-volumes.tdb
-rw------- 1 pi pi 256 Sep 2 18:29 cookie

Yes, paplay is working fine if I playback a WAV-File from the filesystem with paplay <file>
My ~/.mycroft/mycroft.conf just looks like this:

{
“max_allowed_core_version”: 20.8
}

I don’t have a file at /etc/mycroft/mycroft.conf

And yes mpg123 is able to playback mp3 files without problems…

UPDATE:
I think I made some progress. I tracked down the issue with PulseAudio and I think I solved it by adding a user-level systemd service for PulseAudio and enabled it. As you see in the systemd service file for mycroft (above) that it should be started after “pulseaudio.service” - this service was never created. I still don’t have audio from mycroft but now the logs changed:

2020-09-07 11:03:35.788 | INFO | 4634 | mycroft.audio.audioservice:load_services:105 | Loading simple 2020-09-07 11:03:35.798 | INFO | 4634 | mycroft.audio.audioservice:load_services:105 | Loading vlc [afb411c0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused [afb9a690] vlcpulse audio output error: PulseAudio server connection failure: Connection refused 2020-09-07 11:03:35.982 | INFO | 4634 | mycroft.audio.audioservice:load_services_callback:177 | Finding default backend… 2020-09-07 11:03:35.983 | INFO | 4634 | mycroft.audio.audioservice:load_services_callback:181 | Found local 2020-09-07 11:03:35.985 | INFO | 4634 | main:on_ready:30 | Audio service is ready. 2020-09-07 11:04:58.434 | INFO | 4634 | mycroft.audio.speech:mute_and_speak:127 | Speak: hello High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 1.25.10; written and copyright by Michael Hipp and others free software (LGPL) without any warranty but with best wishes Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924 2020-09-07 11:05:14.482 | INFO | 4634 | mycroft.audio.speech:mute_and_speak:127 | Speak: hello High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3 version 1.25.10; written and copyright by Michael Hipp and others free software (LGPL) without any warranty but with best wishes Expression ‘alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 924

If I start the mycroft-cli-client now I have a mic input level indicator and the wakeword is understood but there are still PulseAudio errors and no audio output. I can also ask questions and I got the answer in the cli but there are a lot of errors and no audio output…

Could’ve been so easy…

/etc/mycroft/mycroft.conf:

{
   "play_wav_cmdline": "paplay %1",
   "play_mp3_cmdline": "mpg123 %1",
   "enclosure": {
      "platform": "picroft"
   },
   "ipc_path": "/ramdisk/mycroft/ipc/"
}

~/.mycroft/mycroft.conf

{
  "lang": "de-de",
  "tts": {
    "module": "google",
    "google": {
      "lang": "de"
    },
    "pulse_duck": true
  },
  "max_allowed_core_version": 20.8,
  "hotwords": {
    "hey-mycroft": {
      "module": "precise",
      "local_model_file": "~/.mycroft/precise/hey-mycroft.pb"
    },
  },
  "listener": {
    "wake_word": "hey-mycroft"
  }
}

Relevant for that problem is

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

yet, you should work in the other usefull parts (or at least take this as a template). And now i know why mycroft wanted to download the model

and for the sake of convenience, you should consider working in picrofts’ auto-run.sh (automated update process and mycroft start at bootup) instead of
the service bootup script (you need to adjust some administrative things though)

for the `` "pulse_duck": true to take effect
you need to alter /etc/pulse/defaults.pa

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

That ensures one stream is ducking the other if it happens that 2 overlap each other

Since you’re still at the beginning of setting up mycroft, you might want to consider another option: Brew your own picroft image (using Raspberry OS full)

I made the changes you suggested but now I don’t have any Mic Level nor Output in the CLI again. I am not using the Picroft image - instead I followed this from the docs:
https://mycroft-ai.gitbook.io/docs/using-mycroft-ai/get-mycroft/linux
I installed Mycroft on an already running Raspberry Pi OS (32 Bit) (with PIXEL) which I already had in use. I don’t have that “auto-run.sh” file in my system.

I think the issue is still related to mycroft not being able to access PulseAudio correctly. All other applications work fine but Mycroft fails to use the systems audio… I don’t know what to do next. Maybe the latest Raspberry Pi OS is not working with Mycroft or my system is too messed up now. I will give it another try with a new SD Card and the picroft image or brewing my own image like you mentioned…

yeah, i know you don’t. And i do know you haven’t any auto_run.sh. But i suggest that you set up a picroft-image following the steps in the link i provided. Instead of Raspbian Buster Lite, you would go with the full pixel version.

if you don’t want to do that just use the lines (in the conf; which one doesn’t play a role)

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

NOTE: This is JSON notation, so look ou for , or { or }

and toss the rest. This ONLY tells mycroft where to output stuff. (you’ve said paplay and mpg123 is working). From there go step by step.

May not be the issue here but an issue I had when working on the Mark-2 system services, to connect to pulse the service needed to set XDG_RUNTIME_DIRECTORY to the user’s runtime directory.

(Here’s one of the service-files.)

This could very well be the case since the pa_context_new() refuses connection which indicates some environmental problems.

This suggestion points to another route. Maybe a good suggestion if those problems mounting up or things getting more complex.

Hi again,
as I mentioned above I already created a user-level systemd service file - PulseAudio is working fine with that and all the errors I had with GUI tools (like pavucontrol) are gone. So the connection to PulseAudio is working perfectly. But Mycroft still seems to have difficulty to access the PA Server… Maybe the problem is, that I start Mycroft using a system-wide systemd service and PA is on a user-level now…

1 Like