Score:10

How to split / combine 3 HDMI audios to front-left, front-cetner, front-right?

jp flag

I have three monitors hooked up to my PC with an RTX 2060. aplay -l & pactl list sinks results as below.

How do I get following configured with PulseAudio :

  • The left monitor to be left-only channels.
  • The middle monitor to be centre channels.
  • The right monitor to be the right channels.

I'm currently running Ubuntu 18.04.05.

Sink #10
State: SUSPENDED
Name: alsa_output.pci-0000_01_00.1.hdmi-stereo
Description: HDA NVidia Digital Stereo (HDMI)
Driver: module-alsa-card.c
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 7
Mute: no
Volume: front-left: 30148 /  46% / -20.23 dB,   front-right: 30148 /  46% / -20.23 dB
        balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
Latency: 0 usec, configured 0 usec
Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS

  card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Many thanks for your help.

Adel - MageBinary avatar
jp flag
After days of researching, testing and so on, I have finally got this working. I have documented most steps. I will answer my question shortly. It's amazing. My 3 monitors feel like million-dollar speakers.
Sakchham avatar
br flag
Eagerly waiting for your answer :)
Score:6
jp flag

Okay, generally answering my own questions after days of researching, testing and so on, I have finally got this working. It's amazing. My 3 monitors feel like million-dollar speakers. Thanks for the hint @nusch for pointing me the right direction.

Here are the general steps.

  1. Replace PulseAudio to pipewire.3.x by following the guide at https://pipewire-debian.github.io/pipewire-debian/

  2. Switch HDMI to Pro Audio profile, so all sub HDMI ports on gpu shows up on qpwgraph

enter image description here

  1. Create a remap sink by executing:

    #Don't forget to replace the device name by alsa_output.pci-alsa_output.pci-0000_01_00.1.hdmi-stereo

pactl load-module module-remap-sink master_device=alsa_output.pci-alsa_output.pci-0000_01_00.1.hdmi-stereo master_channel_map=front-left,front-right,front-center channel_map=front-right,front-left,front-center remix=false
  1. Switch the default audio output from the ubuntu gnome sound control to remapped-sink by selecting it as output from GUI.

  2. Build & install qpgraph at https://gitlab.freedesktop.org/rncbc/qpwgraph.

git clone git@gitlab.freedesktop.org:rncbc/qpwgraph.git

#>=Ubuntu 21.x
sudo apt install libasound2-dev libpipewire-0.3-dev libalsaplayer-dev libqt6svg6-dev libgl1-mesa-dev libqt6widgets6 libqt6gui6 qt6-base-dev qt6-base-dev g++ cmake libglx-dev pavucontrol

#<=Ubuntu 20.04
sudo apt install libasound2-dev libpipewire-0.3-dev libalsaplayer-dev libqt5svg5-dev libgl1-mesa-dev libqt5widgets5 libqt5gui5 g++-8 cmake libglx-mesa0 mesa-common-dev qt5-default pavucontrol

#before build
export CC=/usr/bin/gcc-8
export CXX=/usr/bin/g++-8
cmake  -B build
cmake --build build
  1. Using qpwgraph to map the remap sink to playback on each playback on HDMI as followings (No need to restart the service for channel mapping.):

enter image description here

6.1 You can use the gnome sound control to test front, center and right. This makes mapping so much easier.

enter image description here

  1. Useful commands & links

    cat /proc/asound/pcm
    pactl info
    #restart pipewire service
    systemctl --user restart pipewire-pulse.service
    

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/ https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#remap-sink

  1. You can literally map any audio aux to a source depending on your need with pipe wire. It's super awesome. The author of qpwgraph recommended to "ditch PulseAudio altogether".

  2. Enjoy, and don't forget to upvote and improve my answer so more people can enjoy these awesome Linux features.

Bonus points,

1.Awesome music to test out front, center, right channel - https://www.youtube.com/watch?v=3xt8Mp8oWzc

  1. Test your speakers with this video https://www.youtube.com/watch?v=ijSYp6N5Yrs&ab_channel=4KClipsAndTrailers

  2. You can pass your virtual sink to KVM/Qemu as an audio device, so you can game on windows / macOS and use remap sink as your audio device.

To make the changes permanent, it would be great to have someone improve my answer based on the qpwgraph export file.

All the best.

dtrunk avatar
us flag
On 20.04 there are no qt6 packages, it's still qt5 on 20.04.
dtrunk avatar
us flag
And Step 2 requires "pavucontrol" which is not installed by default.
Adel - MageBinary avatar
jp flag
@dtrunk added to the command. Thanks for pointing it out.
Dagelf avatar
tr flag
What am I doing wring if qpwgraph only shows Midi-Bridge nodes?
Adel - MageBinary avatar
jp flag
Pipewire is not installed correctly
Score:1
cn flag

It might be achieved by creating appropriate virtual sink/source in Pulse Audio but I've found it time consuming it's much easier to replace PulseAudio with Pipewire and use it's graphic interface allows to match different inputs chanel wise and per application - see the screenshot here: https://github.com/rncbc/qpwgraph

Adel - MageBinary avatar
jp flag
hey do you know if this works with pulseaudio? Looks like it requires switching to pipewire.
nusch avatar
cn flag
@Adel-MageBinary it does require, however you can use pipewire in parallel to pulseaudio using this guide https://github.com/mikeroyal/PipeWire-Guide#user-content-installing-pipewire-for-debian . As I've written you can achieve the same with pulseaudio but it doesn't have that easy GUI frontend so you need to manually create sinks and sources using command line and in your scripting assure devices numbers won't change . In pipewire frontend you just create your setup by drag&drop and save your setup to file. I'm using it when simultaneously playing a movie on two headsets (bluetooth and USB C)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.