Mycroft Community Forum

No Playback or Mic Input but all audio tests succeed

Hi,

I installed Mycroft on a Raspberry Pi 4 (8GB) with Raspberry Pi OS installed (with Desktop). I used the normal “linux install” via GitHub. The problem is, that there is no output from Mycroft and I get no Mic Input level in the mycroft-cli-client. All other tests like

  1. arecord -d 10 test.wav
  2. aplay test.wav
  3. mycroft-start audiotest -l

were succeeding. I can record some stuff and playback is working. I am using a USB conference mic which is working fine and I use HDMI/Jack for audio output. Everything seems to work - except for Mycroft…

I tried to troubleshoot the issue but I don’t know where to start. From the audio.log I have this:

2020-09-06 13:00:45.048 | INFO | 573 | main:main:50 | Starting Audio Services
2020-09-06 13:00:45.072 | INFO | 573 | mycroft.messagebus.client.client:on_open:114 | Connected 2020-09-06 13:00:45.098 | INFO | 573 | mycroft.audio.audioservice:get_services:61 | Loading services from /home/pi/mycroft-core/mycroft/audio/services/
2020-09-06 13:00:45.106 | INFO | 573 | mycroft.audio.audioservice:load_services:105 | Loading chromecast 2020-09-06 13:00:46.709 | INFO | 573 | mycroft.audio.speech:mute_and_speak:127 | Speak: This unit is not connected to the Internet.
2020-09-06 13:00:48.010 | INFO | 573 | mycroft.audio.speech:mute_and_speak:127 | Speak: Either plug in a network cable or setup your wifi connection. Verbindungsfehler: Verbindung verweigert
pa_context_new() fehlgeschlagen: Verbindung verweigert
Verbindungsfehler: Verbindung verweigert
pa_context_new() fehlgeschlagen: Verbindung verweigert

It seems like there is a connection error with PulseAudio but additional info is missing… One strange thing is the “not connected to the internet” log - my device IS connected to the internet (via LAN) and this is working fine?..

The voice.log is showing some smiliar output:

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition ‘cards.bcm2835_hdmi.pcm.iec958.0:CARD=0,AES0=6,AES1=130,AES2=0,AES3=2’
ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM iec958:{AES0 0x6 AES1 0x82 AES2 0x0 AES3 0x2 CARD 0}
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
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-06 13:00:42.977 | INFO | 581 | mycroft.client.speech.listener:create_wake_word_recognizer:328 | Creating wake word engine
2020-09-06 13:00:42.982 | INFO | 581 | mycroft.client.speech.listener:create_wake_word_recognizer:351 | Using hotword entry for hey mycroft
2020-09-06 13:00:42.991 | INFO | 581 | mycroft.client.speech.hotword_factory:load_module:403 | Loading “hey mycroft” wake word via precise
2020-09-06 13:00:43.016 | ERROR | 581 | mycroft.client.speech.hotword_factory:update_precise:205 | Precise could not be downloaded(ConnectionError(MaxRetryError("HTTPSConnectionPool(host=‘github.com’, port=443): Max retries exceeded with url: /MycroftAI/precise-data/raw/dist/armv7l/latest (Caused by NewConnection$2020-09-06 13:00:43.038 | INFO | 581 | mycroft.client.speech.hotword_factory:install_model:242 | Couldn’t find remote model. Using local file
2020-09-06 13:00:43.072 | INFO | 581 | mycroft.client.speech.listener:create_wakeup_recognizer:365 | creating stand up word engine
2020-09-06 13:00:43.079 | INFO | 581 | mycroft.client.speech.hotword_factory:load_module:403 | Loading “wake up” wake word via pocketsphinx
2020-09-06 13:00:43.425 | INFO | 581 | main:on_ready:175 | Speech client is ready.
2020-09-06 13:00:43.448 | INFO | 581 | mycroft.messagebus.client.client:on_open:114 | Connected
Expression ‘ret’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 1736
Expression ‘AlsaOpen( &alsaApi->baseHostApiRep, params, streamDir, &self->pcm )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 1904
Expression ‘PaAlsaStreamComponent_Initialize( &self->capture, alsaApi, inParams, StreamDirection_In, NULL != callback )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2171
Expression ‘PaAlsaStream_Initialize( stream, alsaHostApi, inputParameters, outputParameters, sampleRate, framesPerBuffer, callback, streamFlags, userData )’ failed in ‘src/hostapi/alsa/pa_linux_alsa.c’, line: 2840

Can anyone help me out here?
Thanks

I think you should tackle your LAN connection before diving in the audio stuff. The sound broblems seem to be a fallout from not being able to connect.

Just curious, do you run on 64-bit kernel?

Hi there,
the connection is totally fine. I can browse, watch youtube, ping google etc… That is not the problem - there must be another problem related to mycroft itself. Do I need to change iptables config or something? Maybe the connection is blocked by any firewall?

The Pi is running an updated 32-Bit Pi OS:
Linux raspberrypi 5.4.51-v7l+ #1333 SMP Mon Aug 10 16:51:40 BST 2020 armv7l GNU/Linux

Oops edited the wrong one.

It surely is for mycroft, since he can’t reach out, hence no precision update or tts processing :wink:

Despite these strange connection errors I get “Audio Service is ready” in the logs:

2020-09-06 14:36:49.636 | INFO | 555 | mycroft.audio.audioservice:load_services:105 | Loading mopidy
2020-09-06 14:36:49.644 | INFO | 555 | mycroft.audio.audioservice:load_services:105 | Loading mplayer
2020-09-06 14:36:49.685 | ERROR | 555 | audioservice_mplayer::20 | install py_mplayer with pip install git+https://github.com/JarbasAl/py_mplayer
2020-09-06 14:36:49.687 | ERROR | 555 | mycroft.audio.audioservice:load_services:114 | Failed to import module mplayer
ModuleNotFoundError(“No module named ‘py_mplayer’”)
2020-09-06 14:36:49.688 | INFO | 555 | mycroft.audio.audioservice:load_services:105 | Loading simple
2020-09-06 14:36:49.699 | INFO | 555 | mycroft.audio.audioservice:load_services:105 | Loading vlc
[a6a41958] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[a6a58bc0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
2020-09-06 14:36:49.891 | INFO | 555 | mycroft.audio.audioservice:load_services_callback:177 | Finding default backend…
2020-09-06 14:36:49.892 | INFO | 555 | mycroft.audio.audioservice:load_services_callback:181 | Found local
2020-09-06 14:36:49.894 | INFO | 555 | main:on_ready:30 | Audio service is ready.

I really don’t know what to do - and I don’t find information about ports needed for Mycroft…

Yeah, he might be ready, but since mycroft can’t connect (for whatever reason) mycroft servers can’t process the utterance (what you are saying)

I just tried to let him speak manually by using the commandline tool mycroft-speak. This is the output in the logs:

2020-09-06 16:16:21.788 | INFO | 555 | mycroft.audio.speech:mute_and_speak:127 | Speak: Hello Verbindungsfehler: Verbindung verweigert pa_context_new() fehlgeschlagen: Verbindung verweigert

So Mycroft can’t connect to PulseAudio (pa_context_new()) but PulseAudio is up and running?

what is
pactl info
saying?

Server-Zeichenkette: /run/user/1000/pulse/native
Bibliotheks-Protokollversion: 32
Server-Protokollversion: 32
ist lokal: ja
Client-Index: 8
Tile-Größe: 65496
Name des Benutzers: pi
Rechnername: raspberrypi
Name des Servers: pulseaudio
Version des Servers: 12.2
Standard-Abtastwert-Angabe: s16le 2ch 44100Hz
Standard-Kanal-Zuordnung: front-left,front-right
Standard-Ziel: alsa_output.platform-bcm2835_audio.analog-mono
Standard-Quelle: alsa_input.usb-Solid_State_System_Co._Ltd._USB_PnP_Audio_Device_000000000000-00.analog-mono
Cookie: 544c:549d

You’ve set up mycroft as a service? Which user is mentioned? I’m guessing pa is mixing up things there.

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?)