linuxaudiopulseaudiohdmixrandr

Use audio over HDMI without displaying over it with xrandr


I have 2 monitors on my desk connected over display-port and I got a tv connected over hdmi.

I am looking for a way to use audio over my hdmi-port without displaying on the tv. The thing is that my tv is connected to an amplifier which is connected to my pc.

tv -> amp -> pc

I want to be able to get my audio to the amplifier while my tv is should be disabled. It's an YAMAHA RX-V775 and HMID-passthrough is enabled.

I tried different xrandr-commands to get this working but I was never able to get the audio working without displaying on the tv (tv doesn't need to be turned on, just enable by xrandr).

This is my current command:

  xrandr --output DP-0 --off --output DP-1 --off --output HDMI-0 --off --output DP-2 --primary --mode 2560x1440 --pos 1080x240 --rotate normal --output DP-3 --off --output DP-4 --off --output DP-5 --mode 1920x1080 --pos 0x0 --rotate left 

I tried the following without success:

  xrandr --output DP-0 --off --output DP-1 --off --output HDMI-0 --set "audio" on  --output DP-2 --primary --mode 2560x1440 --pos 1080x240 --rotate normal --output DP-3 --off --output DP-4 --off --output DP-5 --mode 1920x1080 --pos 0x0 --rotate left

This worked but I was displaying on the tv:

  xrandr --output DP-0 --off --output DP-1 --off --output HDMI-0 --auto --set "audio" on  --output DP-2 --primary --mode 2560x1440 --pos 1080x240 --rotate normal --output DP-3 --off --output DP-4 --off --output DP-5 --mode 1920x1080 --pos 0x0 --rotate left

When hmdi was turned off xrandr --output HDMI-0 --off, I was able to see the hdmi entry in pavuctl but with the statis (unplugged),(unavailable)

I got diffrent resolutions on both monitors (1440p and 1080p), which makes it hard to mirror them without upscaling from a lower resolution to higher one because the desired mode (1440p) can't be selected for the 1080p-monitor. Which results in a bad imagequality.

So my question is: Is it possible to use the hdmi-port for audio while the display is turned off?


Solution

  • After a long time searching on the web, I found a solution to this problem. As mentioned, audio won't work when the display connected over HDMI is disabled. Futher more I didn't wanted to expand my screen to the other display because I would only want to work on my desk while using audio over hdmi.

    The solution is to simply run an xrand command, which will mirror my primary screen on the TV. This is possible even if the TV is turned of. The tricky part is, that xrand might have diffuculties to add custom resolutions especially when using a nvidia gpu and driver. Here is the working command:

    xrandr --output DP-0 --off --output DP-1 --off --output HDMI-0 --mode 1920x1080 --pos 1080x170 --rotate normal --output DP-2 --primary --mode 2560x1440 --pos 1080x170 --rotate normal --output DP-3 --off --output DP-4 --off --output DP-5 --mode 1920x1080 --pos 0x0 --rotate left
    

    I only got it to work througth nvidia-settings where I mirrored the screens. The I merged the config into xorg.conf. After that arandr can be used to export the current setup command.