No audio after boot on GPU audio output

Hello,

I've been using Ubuntu Mate 18.04 since it's release in 2018. I have audio output throught DisplayPort on my GTX 1060. Recently I've been experiencing a strange issue.

Sometimes after boot my audio won't start working until I do following steps (I don't use english as my system language so I don't know exact names of menus and options):

  1. Open system settings
  2. Open audio preferences
  3. In audio preferences, select tab Hardware
  4. At the bottom of the window, in the Profile: option select "Digital Stareo (HDMI 2) output" (this option is blank by default)
  5. Click on button "Test speakers" right next to the option
    And second or two after opening the testing windows audio starts working.

Do you have any idea how to prevent this from happening? I never change my audio output and I'm using the same PC since time of instalation of the OS.

Mikolas

Hi.
Open a terminal window (ctrl+alt+t) and enter this command: pacmd list short sinks.
Scroll with your mouse to figure out the name of your card and the right output in the profiles list.
Here's a bit of what it looks like in my case:

Example
2 card(s) available.
    index: 0
	name: <alsa_card.pci-0000_01_00.1>
	driver: <module-alsa-card.c>
	owner module: 7
	properties:
		alsa.card = "1"
		alsa.card_name = "HDA ATI HDMI"
		alsa.long_card_name = "HDA ATI HDMI at 0xfea60000 irq 68"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:01:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:02.0/0000:01:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "1002"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
		device.product.id = "aac8"
		device.product.name = "Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X]"
		device.string = "1"
		device.description = "Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X]"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	profiles:
		output:hdmi-stereo: Sortie Digital Stereo (HDMI) (priority 5900, available: no)
		output:hdmi-surround: Sortie Digital Surround 5.1 (HDMI) (priority 800, available: no)
		output:hdmi-surround71: Sortie Digital Surround 7.1 (HDMI) (priority 800, available: no)
		output:hdmi-stereo-extra1: Sortie Digital Stereo (HDMI 2) (priority 5700, available: no)
		output:hdmi-surround-extra1: Sortie Digital Surround 5.1 (HDMI 2) (priority 600, available: no)
		output:hdmi-surround71-extra1: Sortie Digital Surround 7.1 (HDMI 2) (priority 600, available: no)
		output:hdmi-stereo-extra2: Sortie Digital Stereo (HDMI 3) (priority 5700, available: no)
		output:hdmi-surround-extra2: Sortie Digital Surround 5.1 (HDMI 3) (priority 600, available: no)
		output:hdmi-surround71-extra2: Sortie Digital Surround 7.1 (HDMI 3) (priority 600, available: no)
		output:hdmi-stereo-extra3: Sortie Digital Stereo (HDMI 4) (priority 5700, available: no)
		output:hdmi-surround-extra3: Sortie Digital Surround 5.1 (HDMI 4) (priority 600, available: no)
		output:hdmi-surround71-extra3: Sortie Digital Surround 7.1 (HDMI 4) (priority 600, available: no)
		output:hdmi-stereo-extra4: Sortie Digital Stereo (HDMI 5) (priority 5700, available: unknown)
		output:hdmi-stereo-extra5: Sortie Digital Stereo (HDMI 6) (priority 5700, available: unknown)

You want to grab the name of the card you use, in this case alsa_card.pci-0000_01_00.1 and since I use Digital Stereo output (HDMI 6) in the preferences, I want the output:hdmi-stereo-extra5 output.

Once you get the right card name and output, you can set the default output using this command:
pactl set-card-profile card output so in my case, pactl set-card-profile alsa_card.pci-0000_01_00.1 output:hdmi-stereo-extra5.

When your command is ready, add it to the startup applications in the preferences. Add a new one, give it a name, paste your command in the command field and you should be good to go.

Install sound Switcher indicator and select the audio output you want. Worked for me on similar issue as you.

In case you don't want to install anything: