If you’ve ever used a Raspberry Pi (like Pi 4 or Pi 5) to output audio via HDMI, you might have run into annoying issues like popping noises or missing the first part of the sound. I faced these problems too and finally found a simple fix using PulseAudio — here’s how you can do it.

1. The Fix That Worked: Use PulseAudio ✅

PulseAudio is better at managing sound for multiple applications. It can play silent audio quietly in the background without blocking other sounds. This keeps the HDMI audio “awake” so you don’t get any pops or missing sound.

2. How to Set It Up 🛠️

Step 1: Install PulseAudio

bash

sudo apt update
sudo apt install pulseaudio -y

Step 2: Start PulseAudio for your user

bash

systemctl --user enable pulseaudio
systemctl --user start pulseaudio

Check it’s running:

bash

pactl info

You should see something like: Server Name: pulseaudio

Step 3: Make a silent audio file

bash

sox -n -r 48000 -b 32 -e signed-integer -c 2 ~/silent.wav trim 0.0 1.0

This creates a 1-second silent WAV file in the right format.

Step 4: Write a keep-alive script

bash

nano ~/hdmi-keepalive.sh

Add this:

bash

#!/bin/bash
while true; do
  paplay ~/silent.wav
  sleep 3
done

Make it executable:

bash

chmod +x ~/hdmi-keepalive.sh

Step 5: Create a systemd user service

bash

mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/hdmi-keepalive.service

Paste this:

ini

[Unit]
Description=Keep HDMI audio alive using PulseAudio

[Service]
ExecStart=/home/pi/hdmi-keepalive.sh
Restart=always

[Install]
WantedBy=default.target

📌 Note: Replace /home/pi/ with your actual username if different.

Step 6: Enable and start the service

bash

systemctl --user daemon-reload
systemctl --user enable hdmi-keepalive
systemctl --user start hdmi-keepalive

3. Conclusion

HDMI audio popping and missing sound at the start can be really annoying on Raspberry Pi. Using PulseAudio to play a silent audio loop in the background keeps the HDMI audio device awake and prevents these issues. This method is simple to set up, works well, and doesn’t block other audio from playing.

If you want smooth and reliable Raspberry Pi HDMI audio without pops or missing sound, this PulseAudio method is a simple and effective solution.

Powered by

nextjs-icon