Audio over HDMI - works only on first device

Hello, I’m trying to abandon Windows and start using Linux as my daily system, but, as expected, things do not go smoothly.

I choosed Fedora, cause on this distribution everything works, the only probem that I’m struggled with is audio over HDMI. What I found is that it is working partially. Sound is played ALWAYS through first HDMI device on the list (aplay -l), regardless of device selected in Audio Settings. The only thing that is changing is volume when switching devices (level is set to the volume set for specific option). This is true only for HDMI devices, if I select bluetooth headphones or S/PDIF option, then audio is correctly played through these interfaces.
Here is result of aplay -l command on my machine

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [PHL 243V7]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [PHL 288E2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [PHILIPS FTV]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Generic_1 [HD-Audio Generic], device 0: ALC897 Analog [ALC897 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Generic_1 [HD-Audio Generic], device 1: ALC897 Digital [ALC897 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

One time after booting order was different (I have no idea why and how I it can be done on purpose), the first device on the list was PHL 2888E2 and then audio was played on that device, rest was the same (chaning HDMI output option had no effect etc.), but after reboot order is again like above.
One more important point. Using speaker-test works always, audio is played on the device passed as the parameter of the command.

I did research on the internet and none of the fixes are working for me, neither

or setting default device in .asoundrc

This really struggles me, as option to select HDMI device through which I want to play audio is pretty important for me. Do anybody have ideas how it can be fixed?

Did you try using wpctl set-default <id>? You can use wpctl status to list the IDs of your sources and sinks and to see which are currently configured as your defaults.

1 Like

I’m not sure if it is correct, but in the audio sinks I have only one option related to HDMI, it changes when I change HDMI device in sound settings.
It looks like that:

Audio
 ├─ Devices:
 │      42. HDA NVidia                          [alsa]
 │      43. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      44. Family 17h/19h/1ah HD Audio Controller [alsa]
 │  
 ├─ Sinks:
 │  *   51. HDA NVidia Digital Stereo (HDMI 2)  [vol: 0.88]
 │      52. Family 17h/19h/1ah HD Audio Controller Cyfrowe stereo (IEC958) [vol: 1.00]
 │  
 ├─ Sources:
 │      53. Family 17h/19h/1ah HD Audio Controller Analogowe stereo [vol: 1.00]
 │  
 ├─ Filters:
 │  
 └─ Streams:
        88. speech-dispatcher-dummy                                     
             81. output_FL       > PHL 288E2:playback_FL	[init]
             84. output_FR       > PHL 288E2:playback_FR	[init]

And after changing HDMI device

Audio
 ├─ Devices:
 │      42. HDA NVidia                          [alsa]
 │      43. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      44. Family 17h/19h/1ah HD Audio Controller [alsa]
 │  
 ├─ Sinks:
 │  *   51. HDA NVidia Cyfrowe stereo (HDMI)    [vol: 1.00]
 │      52. Family 17h/19h/1ah HD Audio Controller Cyfrowe stereo (IEC958) [vol: 1.00]
 │  
 ├─ Sources:
 │      53. Family 17h/19h/1ah HD Audio Controller Analogowe stereo [vol: 1.00]
 │  
 ├─ Filters:
 │  
 └─ Streams:
        88. speech-dispatcher-dummy                                     
             81. output_FL       > PHL 243V7:playback_FL	[init]
             84. output_FR       > PHL 243V7:playback_FR	[init]

Even if there is change visible, audio is played through PHL 243V7 (first device on the list from aplay -l)

Hi! have you try changing the device with alsamixer? or maybe with pavucontrol?

2 Likes

You might need to close and restart your application (e.g. your web browser) for it to pick up the new default after you’ve changed that setting.

As for only seeing the one HDMI device, I’m not sure about that. I’ve never encountered that problem.

Edit: The driver might have options to disable some of the ports if you don’t need all of them. Alternatively, you might be able to disable the a whole HDMI port with a parameter like video=HDMI-1:d on the kernel command line (d means disable; use for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; done to list the names of your ports).

1 Like

Oh my… it works! I used pavucontrol. On ‘Configuration’ tab I had to choose something like ‘Sound in professional applications’ for HDA NVidia (its in system language so I translated it) and then it unlocked four new sinks in wpctl status and as well in audio settings. Names of these sinks is like HDA NVidia Pro, and selecting it changes HDMI device through which audio is played!

Hopefully it will survive reboot. EDIT: It survives :slight_smile:

Thank you guys!

2 Likes