3

Note: This problem occurs because Pulsaudio ignores the settings set by user in the settings-sound menu.

How to force pulsaudio to default to correct audio device?

System:

  • Ubuntu 21.10; NVidia gtx1050ti.

Configuration:

  • 4k monitor plugged into DP port;
  • hdmi2av adapter plugged into hdmi port;
  • analogue stereo plugged into hdmi2av converter.

Desired outcome:

  • 4k video on monitor;
  • HD sound from stereo.

Actual outcome:

  • have 4k video;
  • have no sound from hdmi port after boot and resume.

Reason for no sound: The system does not default to the correct device. On boot and resume, the default is internal speaker.

Actions taken:

  • action, part 1: used 'Settings' to manually set the correct device.

  • action part 1 result: sound works. but upon resume or reboot, sound reverts to internal.

  • action, part 2:

    • reboot
    • added this line to /etc/pulse/default.pa... : set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
    • command: pulseaudio --kill
    • command: pulseaudion --start
  • action part 2 result: settings now shows the correct sound device, and audio coming from hdmi port.

PROBLEM:

At every reboot and resume, must enter commands pulseaudio --kill/--start.

QUESTION:

How to force pulseaudio to default to the correct audio card, device, port, without always needing to: a/ enter the kill/start commands; or b/ reboot or restart?

2 Answers 2

1

After a year of reading everything I could find, and too many trial-and-error attempts, I may finally have found the answer. The process is extremely convoluted, hidden, and frustrating. Here is the process, commands, results, and solution I have discovered...

1/ Finding HDMI output

$ aplay -l

returns...

card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1] Subdevices: 1/1 Subdevice #0: subdevice #0

2/ Testing for the correct card

$ aplay -D plughw:1,7 /usr/share/sounds/alsa/Noise.wav

... if noise is heard, then card+device is correct

(do not proceed until you have found the correct card+device)

3/ To find the pulseaudio sinks in your computer

$ pactl list sinks returns...

3 alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1 module-alsa-card.c s16le 2ch 44100Hz

4/ Manually configuring PulseAudio to detect the Nvidia HDMI

sudo gedit /etc/pulse/default.pa

type these lines at the bottom of default.pa ...

"load-module module-alsa-sink device=hw:1,7"

"set-sink-port alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1"

save and close gedit

Restart PulseAudio:

$ pulseaudio --kill

$ pulseaudio --start

open settings, and check the sound settings

is the correct audio device listed?

5/ switch machine power off, then on to restart

open settings, and check the sound settings

is the correct audio device selected as the default? if yes, done !

1
  • Please forward this issue (and resolution) upstream to the PulseAudio developers. They want their software to work properly without resorting to this workaround.
    – user535733
    Nov 3, 2021 at 14:59
0

SOLVED!

My sincerest thanks to Igor Kovalenko @ Pulseaudio for resolving this issue, finally.

Step 1: verify the correct card (as above).

In my case the relevant address is:

alsa_card.pci-0000_01_00.1

Step 2: set sticky

Invoke terminal and enter:

$ pactl send-message /card/alsa_card.pci-0000_01_00.1 get-profile-sticky

This should return the value of: false.

Change false to true by this command:

$ pactl send-message /card/alsa_card.pci-0000_01_00.1 set-profile-sticky true

Restart the computer: power off/on.

Notes:

All the above would not be necessary IF the folks at Ubuntu would add to the repositories the updated release for pavucontrol 5.0

Pavucontrol 5.0 has the GUI to choose and lock the HDMI card + port. Prior versions (eg 4.2 from repository) have not this feature.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .