Custom authority-id & brand-id due to the custom gadget
Grade dangerous
If I run aplay -l as root, it lists vc4hdmi0 and vc4hdmi1, so ALSA is able to see the HDMI monitor. And I’m able to hear a .wav file played with aplay.
I have installed Pulse Audio from the beta channel: sudo snap install --beta pulseaudio
But, pulseaudio.pactl list sinks only lists Dummy Output. How can I get Pulse Audio to detect the HDMI sinks which ALSA is using?
Thanks for the reply - your knowledge on this forum is amazing.
I downloaded & built your pulse-server, and snapped it onto the Pi 5, but unfortunately when run as root, pulse-server.pactl list sinks still only outputs the Dummy Output.
I first tried it without pulseaudio installed, and it said “pa_context_connect() failed: Connection refused” which leads me to believe that pulse-server relies on pulseaudio?
pulse-server ships pulseaudio (this is in fact its only purpose )
I wonder if the Pi5 simply handles HDMI audio different than its former versions (i sadly don’t have a Pi5 around to try) or if there are still kernel patches missing (remember how new the hardware is, the pi Ubuntu kernel predates its release)
@ogra, I had assumed pulse-server was a replacement for pulseaudio, which is why I tried without pulseaudio installed first.
Doesn’t pulseaudio / pulse-server depend on ALSA? aplay works, so to me it seems like a problem connecting pulseaudio / pulse-server to ALSA, not a problem from ALSA to the HDMI port. Are any environment variables, snap connections, or libraries required to make pulseaudio / pulse-server work?
Yes, that is exactly what it is, it ships pulseaudio inside (like the pulseaudio snap does, just at a different version with different patch sets), they are the same thing in different variants … and indeed you don’t want to have both installed at the same time
Both snaps are based on core20 though (which corresponds to 20.04) and as you can see looking at the snapcraft.yaml they also build alsa-lib, alsa-plugins and alsa-ucm-conf from certain source tags, all this might just be too old …
I must admit I don’t remember anymore (I built that snap in 2021), I know i tested and ran it on a Pi3 and 4 back then but can’t remember if I tested with a monitor (without speakers) or TV …
It’s worth potentially looking at Install pipewire on Linux | Snap Store - this will be supported in Ubuntu Core Desktop which ultimately is still Ubuntu Core. I’m not sure it’s ready for prime time yet but if the alternatives are literally functionless then a nicely confined beta is worth considering and I’m sure they could use the feedback if you have any to give!
Pipewire should be capable of providing Pulseaudio sockets.
@James-Carroll,
Thanks for the advice. I managed to get pipewire installed using:
sudo snap set system experimental.user-daemons=true
sudo snap install --edge pipewire
However, pactl list sinks is still outputting:
pa_context_connect() failed: Connection refused
I found a post recommending to use wpctl instead of pactl however wpctl is crashing even when simply running with the -h option to display help:
root@localhost:~# wpctl -h
W 18:30:48.338855 pw.loop ../src/pipewire/loop.c:67:pw_loop_new: 0xaaaace36a840: can't make support.system handle: No such file or directory
Segmentation fault (core dumped)
The pipewire snap is not ready for consumption on a plain Core without desktop session yet (on plain core it needs to be a system daemon as there are no user sessions (and on actual production devices that usually are managed via a fleet mgmt there aren’t even users at all)) …
Funnily I talked to @SergioCostas yesterday about this after taking a quick look at the packaging … on the packaging side it should be easy to achieve what is needed, but we need to do some tests to judge the behavior of pipewire in such a mode, this might take a bit of time…
@ogra Thanks again for the insightful response. Please keep me posted on testing and when something might be available. I can wait some time.
The use case is a check-in kiosk. There is an RFID reader and a QT6 application. I simply want to hear a “beep” when an RFID card is read. I have it working on a regular Ubuntu Desktop 24.04 installation on a PC. Now it just needs to work on the Pi 5 with Ubuntu Core.
An alternate option for me might be to recompile QT with ALSA support, but I’d prefer to avoid compiling such a large package - I’m sure it will require a large dependency tree to achieve.
Yeah, that would have been my suggestion for a quick solution, just have your app use alsa … especially in kiosk mode it is unlikely to have concurrent access of different apps to the audio device which is the actual purpose of running a sound daemon
I managed to find time to recompile QTMultimedia with ALSA support, and can confirm I now hear sound from my application. There are quality issues which I haven’t investigated yet. Thanks to @ogra for confirming this was the right direction 2 weeks ago. To build QTMultimedia version 6.4.2:
git clone --branch 6.4.2 git://code.qt.io/qt/qt5.git
mkdir -p build
cd qt5
./init-repository --module-subset=qtmultimedia,qtbase,qtshadertools
cd ../build
../qt5/configure -submodules qtmultimedia -no-pulseaudio -alsa
cd ..
echo Applying the patch from https://code.qt.io/cgit/qt/qtbase.git/commit/?id=8af35d27e8f02bbb99aef4ac495ed406e50e3cca
cd qt5/qtbase
git apply ../../XKB_KEY_dead_lowline.patch
cd ../../build
cmake --build . --parallel 4
cd ..
Output is in build/qtbase/lib/libQt6Multimedia.so.*
ALSA support in Qt 6.4.2 is bad. 6.8.2 works. Some changes were made for endian issues which probably fixed it. I didn’t want to upgrade everything to Qt 6.8, hence I simply copied the src/multimedia/alsa folder from 6.8.2 back to 6.4.2 and recompiled and that seems to have fixed it for me.
FWIW the pipewire snap seems to be making some traction lately, so I imagine it could be worth re-evaluating that later in the year should it become capable of working on normal core systems (I.E not just Ubuntu Core Desktop itself). It fundamentally should be able to, it’s just waiting on wiring it up, I’ve seen some AppArmor/interfaces work on Github for it for example, with changes to audio-playback & etc to accomodate it.
e.g.,
This is currently still not usable on plain UbuntuCore as is, since it was packaged as a user-daemon snap for UbuntuCoreDesktop … i.e. it requires a user session and will only play sounds as that user (while on plain core pretty much everything runs as root and you ideally do not even have any user at all)