Skip to content

Instantly share code, notes, and snippets.

@basso
Last active December 1, 2025 12:32
Show Gist options
  • Select an option

  • Save basso/04cbdc9cad5629f2ae83a941875c4ad5 to your computer and use it in GitHub Desktop.

Select an option

Save basso/04cbdc9cad5629f2ae83a941875c4ad5 to your computer and use it in GitHub Desktop.
Bazzite Linux How to force transcode Dolby Digital AC3 5.1 over HDMI ARC
COMPATIBILITY WARNINGS:
LG TV 2017: Outputs loud white noise on occation.
CHANGE NOTES:
22.11.25 Added a systemd unit to send backround noise to pcm to make it keep alive, this will stop audio from cutting on idle
23.11.25 Change default bitrate to be 640kbit, max for HDMI ARC.
24.11.25 Workaround for alsa card changing from 0 to 1, or 1 to 0 on reboots.
24.11.25 Normalize working on systemd units, now its only ac3 and ac3-keepalive
I have managed to get the alsa-plugins-a52 to output over HDMI on bazzite.
This is Virtual HDMI Alsa Sink that outputs transcoded AC3 directly over the HDMI output.
Problem 1: TV's like Samsung does not support LPCM 5.1 over HDMI EARC.
Problem 2: Many recievers in use today only support HDMI ARC, which means only PCM 2.0 / Dolby Digital or DTS.
How to fix on Bazzite so you can enjoy surround sound in your games in your home theater setup :
1. Install alsa-plugins-a52
sudo rpm-ostree install alsa-plugins-a52
Reboot to get the changes.
2. Install Pulse Audio Volume Control flatpak
Use the included flatpak store in Bazzite.
3. Open up Pulseaudio Volume Control and navigate to configuration and turn off the TV HDMI output to release it for our usage.
4. Use aplay -l to list your audio devices, we are interested in the one that is connected to TV.
aplay -l
--EXAMPLE OUTPUT--
**** List of PLAYBACK Hardware Devices ****
card 0: A50 [A50], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: A50 [A50], device 1: USB Audio [USB Audio #1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [SAMSUNG]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]
Subdevices: 1/1
Subdevice #0: subdevice #0
--EXAMPLE OUTPUT--
5. As we can see, my hardware device for my Samsung TV is
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [SAMSUNG]
Subdevices: 1/1
Subdevice #0: subdevice #0
Which means CARD 1, DEVICE 10.
6. Create custom .asoundrc file to take control over HDMI and push ac3 audio out of it.
nano ~/.asoundrc
--COPY THIS--
# 1. The Raw Encoder (Strict)
# This does the heavy lifting but is picky about input
pcm.a52_raw {
type a52
rate 48000
bitrate 640
channels 6
format S16_LE
# Direct hardware addressing for Card 1, Device 10, YOUR CARD AND DEVICE CAN BE DIFFERENT, CHECK APLAY OUTPUT
slavepcm "hw:HDMI,10"
}
# 2. The Safe Wrapper (Use this one!)
# This converts app audio to what the encoder needs
pcm.a52_safe {
type plug
slave.pcm "a52_raw"
hint {
show on
description "TV (AC3 Surround)"
}
}
--COPY THIS--
7. Test
speaker-test -D a52_safe -c 6 -r 48000
if it works proceed.
8. create systemd unit to make the new device automaticly
nano ~/.config/systemd/user/ac3.service
--COPY THIS--
[Unit]
Description=Force AC3 Surround Sink for HDMI
# We must wait for the audio server to be ready
After=pipewire-pulse.service
Wants=pipewire-pulse.service
[Service]
Type=oneshot
# 1. Wait a moment for devices to settle
ExecStartPre=/usr/bin/sleep 5
# 2. Create the AC3 device
# This checks if 'TV_AC3' exists; if not, it loads it.
ExecStart=/bin/bash -c "pactl list short sinks | grep -q TV_AC3 || pactl load-module module-alsa-sink device=a52_safe sink_name=TV_AC3 sink_properties=device.description='TV_Surround_5.1'"
# 3. Retry logic if it fails on first boot
Restart=on-failure
RestartSec=10
RemainAfterExit=yes
[Install]
WantedBy=default.target
--COPY THIS--
systemctl --user daemon-reload
systemctl --user start ac3.service
systemctl --user enable ac3.service
9. Create the "Keep Alive" Service
This prevents your receiver from clicking or sleeping during silent moments in games/movies. It plays invisible digital silence into the sink created in Step 8.
~/.config/systemd/user/ac3-keepalive.service
--COPY THIS--
[Unit]
Description=Keep AC3 Output Alive with Silence
# Wait for the sink creator from Step 8 to finish
After=force-ac3.service
[Service]
Type=simple
# Plays raw PCM silence (48kHz, 16-bit, Stereo) into the TV_AC3 sink.
# This ensures the encoder always receives data.
ExecStart=/usr/bin/paplay --raw --format=s16le --rate=48000 --channels=2 --device=TV_AC3 --property=media.role=background --latency-msec=2000 /dev/zero
# Restart automatically if it crashes
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
--COPY THIS--
systemctl --user daemon-reload
systemctl --user enable --now ac3-keepalive.service
reboot computer
10. You will now get a new output device called TV_AC3, it will automaticly be created on startup,
and recreated if TV was turned off.
It will also send background noise to PCM to keep it alive.
Please enjoy your Dolby Digital 5.1 over HDMI ARC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment