Tech

Get HDMI Audio Working on Ubuntu for Raspberry Pi


Learn how to switch Raspberry Pi’s audio output to HDMI in the Ubuntu operating system and make the setting permanent.


On a Raspberry Pi, the Ubuntu Desktop and Ubuntu MATE operating systems output audio to the 3.5mm audio port by default. For the audio to be carried over an HDMI cable, the audio output device needs to be manually selected every time the Pi boots. The issue persists even in the latest version of the Ubuntu flavored OS for the Pi, 22.04.


If your Raspberry Pi is connected to a television or a monitor with built-in speakers, it is wise to transmit the audio over HDMI. It reduces cable clutter and also the need for additional external speakers.


Available Options to Set HDMI Audio

You can set a Raspberry Pi to output audio through HDMI using Ubuntu Settings/Control Panel, but the setting will not survive a reboot. We’ll show you how to use the pactl command to configure the audio sinks to set HDMI as the default audio output permanently.

How to Manually Set HDMI Audio Output in Ubuntu

Setting up the Raspberry Pi as a media server may not require an audio output, but it needs audio for sure when the Pi itself is the media device. First up, you need to check if HDMI audio is working alright, by selecting it manually.

  1. In Ubuntu Desktop OS, click Activities, type Settings, and select Sound. If using Ubuntu MATE, navigate to Menu > Control Center > Sound.

  2. Using the dropdown menu, change the Output Device from Headphones to Digital Output (S/PDIF).

  3. Play a sample audio file (or a YouTube video) to verify that the monitor’s speakers are playing the audio. If testing is successful, you can proceed to make this setting permanent.

How to Permanently Set HDMI Audio as Default

In order for the setting to remain intact across reboots, you need to set HDMI as the default audio output at startup. For that, you need to find the device name first.

Identify the HDMI Audio Device

The command pactl can control a running PulseAudio sound server. A “source” is the input device, and a “sink” is the output device.

List all the available audio output devices on the Raspberry Pi:

pactl list short sinks

Note down the device with HDMI in the name.

Configure to Make HDMI the Default Audio Device

Search for Startup Applications Preferences and open it. Click Add Startup Program and fill in these details:

  • Name: HDMI Audio
  • Command: pactl set-default-sink ‘YOUR HDMI DEVICE’ (e.g., pactl set-default-sink ‘alsa_output.platform-fef00700.hdmi.iec958-stereo’)
  • Comment: HDMI Audio as Default

Click Add. This command will run every time the Pi starts and the audio will play over HDMI even after a reboot.

How to Switch to 3.5mm Audio When Needed

If you want to switch to 3.5mm audio during a live session, set the audio output device to Headphones – Built-in Audio in settings. If 3.5mm audio needs to be restored as the default output, you can uncheck the command in Startup Applications Preferences, and it will not run.

Raspberry Pi Has a Huge Array of Audio Options

HDMI audio, 3.5mm audio, Bluetooth audio, and USB sound cards—the Raspberry Pi has a ton of options when it comes to audio. It is a matter of choice what you want to use for your application, but now you know how to set the default audio output for it in Ubuntu and keep the setting after a reboot.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button