Skip to main content

Arch Linux | How to Enable HDMI Audio Output in Arch Linux

·
Arch

When setting up a new Arch Linux system, you might encounter issues getting audio output through HDMI, especially when using a monitor with built-in speakers. This article will introduce my experience of configuring my system to output audio via HDMI.

Prerequisites
#

  • An Arch Linux system with administrative privileges.
  • A monitor with built-in speakers connected via HDMI.
  • Basic knowledge of the command line.

Step 1: Install Necessary Packages
#

First, ensure you have the required audio utilities installed.

Install alsa-utils
#

The alsa-utils package provides essential tools for managing ALSA (Advanced Linux Sound Architecture).

sudo pacman -S alsa-utils

Step 2: Identify Your Audio Devices
#

Before configuring audio output, identify your system’s audio devices.

List Audio Playback Devices
#

Use the aplay command to list all playback devices:

aplay -l

Sample Output
#

**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [LG ULTRAFINE]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Interpretation:

  • Card 0: HDMI audio device (your monitor).
  • Card 1: Internal audio device (motherboard’s sound card).

Step 3: Install and Configure PulseAudio
#

PulseAudio is a powerful sound server that can manage audio devices more effectively than ALSA alone.

Install PulseAudio and Related Packages #

sudo pacman -S pulseaudio pulseaudio-alsa

Start PulseAudio
#

Start the PulseAudio service:

pulseaudio --start

Note: If you receive a command not found error, ensure that the installation was successful.

Step 4: Set HDMI as the Default Audio Output
#

To ensure audio outputs through HDMI by default, configure PulseAudio accordingly.

Create Configuration Directory
#

If the directory doesn’t exist, create it:

mkdir -p ~/.config/pulse

Create or Edit client.conf
#

nvim ~/.config/pulse/client.conf    # The editor I use is neovim

Add the Following Configuration
#

autospawn = yes

Identify the HDMI Sink Name
#

List all available sinks to find the HDMI output’s sink name:

pactl list sinks short

Sample Output
#

0   alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1   module-alsa-card.c  s16le 2ch 44100Hz   RUNNING
1   alsa_output.pci-0000_00_1b.0.analog-stereo        module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED

Identify the sink corresponding to your HDMI output (usually containing hdmi in the name).

Update client.conf with Default Sink
#

Add or modify the default-sink line in client.conf:

autospawn = yes
default-sink = alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1

Replace alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1 with the sink name identified in the previous step.

Restart PulseAudio
#

Apply the changes by restarting PulseAudio:

pulseaudio -k
pulseaudio --start

Step 5: Use pavucontrol to Manage Audio Devices
#

pavucontrol (PulseAudio Volume Control) provides a user-friendly graphical interface to manage audio devices.

Install pavucontrol
#

sudo pacman -S pavucontrol

Launch pavucontrol
#

pavucontrol

Configure Output Device
#

  1. Navigate to the Output Devices tab.
  2. Find your HDMI device (e.g., HDMI / DisplayPort or the name of your monitor).
  3. Set it as the default output device by using the webpage.

Note
#

If you encounter the message Establishing connection to PulseAudio. Please wait..., it indicates that pavucontrol cannot connect to the PulseAudio server. Ensure that PulseAudio is running correctly (see the following for troubleshooting).

Step 6: Troubleshooting Common Issues
#

Issue: pulseaudio Command Not Found
#

Symptom: Running pulseaudio --check or pulseaudio --start results in command not found.

Solution:

  • Ensure pulseaudio is installed:

    sudo pacman -S pulseaudio pulseaudio-alsa
    
  • Verify installation:

    which pulseaudio
    

    This should output the path to the pulseaudio binary, such as /usr/bin/pulseaudio.

Issue: pavucontrol Cannot Connect to PulseAudio
#

Symptom: pavucontrol displays Establishing connection to PulseAudio. Please wait... indefinitely.

Solution:

  1. Check if PulseAudio is Running:

    pulseaudio --check
    

    If no output is returned, PulseAudio is running.

  2. Start PulseAudio Manually:

    pulseaudio --start
    
  3. Restart PulseAudio:

    pulseaudio -k
    pulseaudio --start
    
  4. Check for Errors:

    View PulseAudio logs for any errors:

    journalctl --user -xe | grep pulseaudio
    

Issue: No Sound Output After Configuration
#

Symptom: After setting HDMI as the default output, there’s still no sound.

Solution:

  1. Check Volume Levels:

    Ensure that the output is not muted and the volume is turned up.

    alsamixer
    

    Use the arrow keys to adjust volume and M to toggle mute.

  2. Test Audio Playback:

    Use speaker-test to test audio output:

    speaker-test -D hw:0,7 -c 2 -t wav
    

    Replace hw:0,7 with your HDMI card and device numbers from the aplay -l output.

  3. Ensure Correct Sink Is Set:

    Verify the default sink in PulseAudio:

    pactl info | grep "Default Sink"
    

    It should match your HDMI sink name.

References
#