10

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.

2
  • 1
    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. Commented Dec 18, 2022 at 4:59
  • 1
    Eagerly waiting for your answer :)
    – Sakchham
    Commented Dec 18, 2022 at 19:45

2 Answers 2

6

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 [email protected]: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.

5
  • On 20.04 there are no qt6 packages, it's still qt5 on 20.04.
    – dtrunk
    Commented Dec 19, 2022 at 11:31
  • And Step 2 requires "pavucontrol" which is not installed by default.
    – dtrunk
    Commented Dec 19, 2022 at 11:45
  • 1
    @dtrunk added to the command. Thanks for pointing it out. Commented Dec 19, 2022 at 22:03
  • What am I doing wring if qpwgraph only shows Midi-Bridge nodes?
    – Dagelf
    Commented Mar 18, 2023 at 10:01
  • Pipewire is not installed correctly Commented Mar 19, 2023 at 12:43
1

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

3
  • hey do you know if this works with pulseaudio? Looks like it requires switching to pipewire. Commented Dec 14, 2022 at 8:12
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Dec 15, 2022 at 12:05
  • @Adel-MageBinary it does require, however you can use pipewire in parallel to pulseaudio using this guide github.com/mikeroyal/… . 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)
    – nusch
    Commented Dec 18, 2022 at 16:50

You must log in to answer this question.

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