Sound Through HDMI on Ubuntu 18.04 – How to Fix Audio Issues

18.04hdmipulseaudiosound

I have had an issue with sound ever since I installed Ubuntu. On boot up I can select HDMI sound and it works, when the monitor sleeps one of two things happen.

Either the sound reverts to another source and I have to switch back to it in the settings, which is annoying but not unrecoverable, or the sound stays on the HDMI source but I get no sound and have to reboot to get it back.

throughout this the HDMI source is always available and I can select it. but I always have one of the two issues.

I am loving the experience with Linux at the moment but this is starting become a deal breaker, can someone please help ?

thanks

Best Answer

Simple Solution

When signal is lost to HDMI (during sleep) Pulse Audio is automatically configured to active source (your laptop's speakers). Upon resume the sound device is still your laptop. To override this setting, tell Pulse Audio to never switch sound devices automatically:

  • edit the file /etc/pulse/default.pa
  • find the line load-module module-switch-on-port-available
  • insert a # at the beginning of the line to disable automatic port switching
  • save the file and reboot.

Complex Solution

Before I learned of the simple solution, I used a more complex solution based on systemd suspend/resume hook:

An even more complex solution for when HDMI TV is unplugged and replugged is based on udev rule:

Extensive Forum Thread

In Linux Mint forum there is an extensive thee page thread on this topic: