Introduction
Many users experience issues with PipeWire, a sound server for Linux, automatically switching their HDMI audio profile when they connect an external screen. This can be frustrating, especially when the screen wakes up from power saving mode. This article aims to provide a detailed explanation of the issue and offer potential solutions.
Understanding PipeWire and HDMI Audio
PipeWire is a sound server that aims to provide audio capabilities for Linux systems. It was designed to improve latency and performance compared to previous sound servers like PulseAudio. HDMI audio, on the other hand, is a digital audio signal that can be transmitted over HDMI cables from a PC to an external display.
Why does PipeWire switch HDMI audio profiles?
PipeWire automatically switches HDMI audio profiles when it detects a change in the audio hardware. This is a default behavior that aims to provide a seamless audio experience. However, it can be problematic for users who prefer to keep their audio settings consistent.
Potential Solutions
The following are potential solutions to stop PipeWire from switching HDMI audio profiles when connecting an external screen.
Use a different sound server
One solution is to switch to a different sound server like PulseAudio or ALSA. This can be done by uninstalling PipeWire and installing the desired sound server. However, this may not be a viable solution for users who rely on PipeWire's low latency and performance improvements.
Modify the PipeWire configuration
PipeWire's configuration can be modified to prevent it from switching HDMI audio profiles. This can be done by creating a custom configuration file or modifying an existing one. Here's an example of how to create a custom configuration file:
# Create a backup of the default configuration file
cp /etc/pipewire/pipewire.conf /etc/pipewire/pipewire.conf.backup
# Create a new configuration file
nano /etc/pipewire/pipewire.conf
Add the following lines to the new configuration file:
[Server]
profile = ${sysconfdir}/pipewire/pipewire.profile
[Logging]
level = INFO
Create a new profile file with the following lines:
[General]
audio-format = "flat"
Restart PipeWire for the changes to take effect:
sudo systemctl restart pipewire
Use a udev rule
A udev rule can be created to prevent PipeWire from switching HDMI audio profiles when an external screen is connected. Here's an example of how to create a udev rule:
sudo nano /etc/udev/rules.d/51-pipewire-no-hdmi-switch.rules
Add the following lines to the new udev rule:
ACTION=="change", KERNEL=="card*", ATTR{device/product}=="HDMI", ATTR{device/chestra}="0", RUN+="/usr/bin/pactl set-card-profile %k output:analog-stereo"
Restart udev for the changes to take effect:
sudo udevadm control --reload-rules && sudo udevadm trigger
- PipeWire automatically switches HDMI audio profiles when it detects a change in the audio hardware. This can be frustrating for users who prefer to keep their audio settings consistent.
- One solution is to switch to a different sound server like PulseAudio or ALSA. Another solution is to modify the PipeWire configuration to prevent it from switching HDMI audio profiles. A third solution is to use a udev rule to prevent PipeWire from switching HDMI audio profiles when an external screen is connected.