24

My Ubuntu 17.10 is connected via HDMI with my TV. HDMI ist the audio device I want always to use. Sometimes when the TV is turned off, Ubuntu switches the audio device tho semething else. When I turn on the TV again, I have to switch it back manually. How to prevent this automatic switching and set the audio device once and forever?

Witek
  • 3,933
  • This should do what you need, by disabling the automatic output device switching, so that the output always stays on what you set it to: https://askubuntu.com/questions/228619/disable-sound-through-hdmi-permanently – Jonas Czech Jan 02 '18 at 12:50

3 Answers3

18

In /etc/pulse/default.pa comment out module-switch-on-port-available:

# load-module module-switch-on-port-available

Then restart.

Witek
  • 3,933
10

You must deactivate all modules that start with module-switch-on-* in pulse audio service if you want to disable this behavior also with bluetooth and USB devices.

Ubuntu 18.04 and 20.04 LTS, for example:

  • module-switch-on-port-available
  • module-switch-on-connect

In a single instruction:

sudo sed -ri 's/^(load-module module-switch-on-.*$)/# \1/' /etc/pulse/default.pa

Then kill pulse audio or reboot:

pulseaudio -k
1

Yes, Witek's answer worked for me. I am new to Ubuntu (Xubuntu) so I didn't even know how to even comment out a line. So for people like me, here's a more detailed answer:

Go to your file manager and click "file system". Then find /etc/pulse/default.pa

Open that file using any text editor.

Putting a hash symbol # in front of a line of code is how you comment out a line. Put a hash in front of the line that reads:

load-module module-switch-on-port-available

When you click save, it will ask for your admin password. Enter it, restart and you're done.

Zanna
  • 70,465