2

I'm on Raspberry pi 4 and the OS is DietPi
I configured ALSA so I could play an audio file successfully through HDMI using aplay [an audio file]
Then launched the PyQt5 app but got PulseAudioService: pa_context_connect() failed. So installed PulsAaudio and enabled its service.

The Service:

[Unit]
Description=Sound Service

[Service]
Type=notify
ExecStart=/usr/bin/pulseaudio --daemonize=no --exit-idle-time=-1 --disallow-exit=true
Restart=always

[Install]
WantedBy=default.target

Now, I don't get PulseAudioService: pa_context_connect() failed anymore, but neither aplay nor in-app sounds work.
I should probably mention that aplay seems playing, because the console's hold (run) time is equal to the length of the audio, but there's no sound.

1 Answer 1

1

I could make alsa's aplay work by using aplay [audio file] -D sysdefault:CARD=0 which shows that the default device has changed.
available cards (sinks in PA) can be seen using pacmd list-sinks. For me, cards were:
0- HDMI
*1- 3.5m Jack
in which the default was the wrong one (1).
Make sure hdmi_drive=2 is uncommented in /boot/config.txt if you consider using HDMI.
Default sink can be changed using pacmd set-default-sink [sink index]

1
  • Isn't that command pactl? Maybe on rPi it's different.
    – Kingsley
    Commented Mar 1, 2023 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.