Picroft - No sound with 3.5mm jack output

Hello,

I’m trying to set up a Picroft on a Raspberry Pi 3B with a PS3 eye and a speaker connected with a 3.5mm jack. The microphone is working fine but I have no sound… Can someone help me?

Rémi

What have you tried so far? What was the result of that effort? What’s in the logs (/var/log/mycroft/*)?

I tried to change the default sink (because it offers me two) as shown in the Mycroft AI Audio Troubleshooting guide and I also tried to configure the sound output of the rapsberry (with the raspi-config menu) so that it uses headphones. But nothing worked, no sound comes out…

I have tried what is shown on this page (https://windowsreport.com/raspberry-pi-audio-not-working/) and I have some sound when I run “./hello_audio.bin”. But when I try something like “speaker-test -c2 -twav” (as recommended here https://www.tinkerboy.xyz/raspberry-pi-test-sound-output/), I have no sound…

Do you think this is a problem with playing .wav?

Is PulseAudio installed/used or plain ALSA? I.e. by default, Mycroft uses paplay to play wav files, so that would be a test that is coming closer. You say microphone is working fine, so you could try:

cd /tmp
arecord -d 3 test.wav # Then make some noise for 3 seconds
paplay test.wav
aplay test.wav # just to test plain ALSA as well

raspi-config btw produces the following asound.conf override for the current user (~/.asoundrc):

pcm.!default {
  type asym
  playback.pcm {
    type plug
    slave.pcm "output"
  }
  capture.pcm {
    type plug
    slave.pcm "input"
  }
}
pcm.output {
  type hw
  card $AUDIO_OUT
}
ctl.!default {
  type hw
  card $AUDIO_OUT
}

AUDIO_OUT is set to the sound card ID selected. As you said there were two, most likely those were HDMI sound on ID 0 and “headphones” (=3.5mm jack) on ID 1.

I played around with ALSA configs and Mycroft in the past (and do just now again) and I’m not sure whether the “asym” plugin is such a good idea here. You could test instead (cat for copy&paste to console):

cat << '_EOF_' > ~/.asoundrc
pcm.!default {
  type plug
  slave.pcm {
    type hw
    card 1
  }
}

ctl.!default {
  type hw
  card 1
}
_EOF_

Try card 0 as well, if the above does not work, or verify which ID is which card via aplay -l.

But as you see this is all about ALSA, while I have not really an idea how PulseAudio acts on top of that.

hi Remi, have you managed to fix this issue?

I’m having the exact same issue with a raspberry pi 4, 3.5mm jack out and ps3 eye in. microphone appears to be working fine but cannot get any output from 3.5mm jack.

Hi,

No, I haven’t solved my problem yet and I must admit that I haven’t yet taken the time to try MichaIng’s advice.
Can you try and then tell me if it worked?

I have the same problem - no any sound on 3,5mm jack audio. I tried what @MichaIng said above (btw I didn’t had .asoundrc by default) but it’s still not working.

Temporary solution for now is to reboot device only with plugged 3,5mm jack without any HDMI screen and control device using ssh.

Did you also run the paplay and aplay tests?

What I am wondering is that Picroft by default comes with PulseAudio setup, AFAIK, but raspi-config audio config configures plain ALSA. I have no experience with PulseAudio, but would assume that setting up both somehow might conflict and break sound :thinking:.
EDIT: Ah, based on the default config file, it uses plain ALSA to play wav sounds but forces HDMI output in most cases on new RPi kernel (see below): https://github.com/MycroftAI/enclosure-picroft/blob/buster/etc/mycroft/mycroft.conf

Another thing is that Raspberry Pi with the newest kernel changed the audio interface. Prior to the change, HDMI and 3.5mm jack output was all on asound card 0, now 3.5mm jack is on card 1, if a HDMI monitor is attached. Probably Picroft didn’t adapt to this change yet.

Yes, I used both commands and neither gave me a sound

I just found: Sound always go through hdmi

That symptom and workaround, which matches yours, would pretty much fit to the assumption that Picroft ships with a audio config that has not been updated yet to support the new RPi kernel audio interface changes.

… checking source code: https://github.com/MycroftAI/enclosure-picroft/blob/buster/etc/mycroft/mycroft.conf#L2

Okay pretty simple: The default Mycroft config forces audio output to card 0, which is HDMI only, if a monitor attached. These settings override the ALSA config.

Please edit /etc/mycroft/mycroft.conf and either change in the first two settings "hw:0,0" to "hw:1,0" or remove the card+device options completely so that the values are "aplay %1" and “mpg123 %1” and hence respect the ALSA settings (~/.asoundrc).

EDIT: Ah, since that config file will be overwritten on updates, AFAIK, better create/edit the local user override, which should be located at: $HOME/.mycroft/mycroft.conf

EDIT2: That should fix the issue so that raspi-config selection, respectively manual ALSA configuration is respected: https://github.com/MycroftAI/enclosure-picroft/pull/150


Btw, to review all sound devices and their card and device IDs, run: aplay -l

3 Likes

Something that I can also mention for this discussion is that the Pi OS that the Picroft is built on includes some prerecorded .wav files, they are located in /usr/share/sounds/alsa.
Use the cd command to change to that directory, then type
aplay ./<file_name>.wav

The screen should indicate the sound file is playing, and it will be at a reasonable volume.
If no sound is heard through the 3.5mm jack, that suggests the system isn’t configured to play through that connector.
I thought I was not going to be able to use Picroft on either a Pi3+B or Pi4, until I remembered to test the playback system hardware with the prerecorded files.

I can confirm that this is a valid workaround. The HDMI has something to do with the 3.5mm audio.

I have a screen with the display ribbon cable and that was able to be used while having all other devices (mic, 3.5mm headphones and keyboard) plugged in and the display was working.