You are not logged in.
Yesterday I replaced pulseaudio with pipewire-pulse. The main reason was pulseaudio suddenly wasn't showing my onboard soundcard anymore (that is most of the time.)
I had pulse configured to send audio both to my wireless usb-headset and my amplifier, so I could switch devices by turning one on and the other one off.
I want to do the same thing with pipewire. I currently have a quite messy workaround to achieve the same, but it's far from ideal and I'm looking for improvement.
There is also an open issue, so it can be properly configured in the configuration file in the future.
https://gitlab.freedesktop.org/pipewire … issues/456
make sure pipewire-jack and pipewire-pulse are installed.
Then create a sink, with pactl
Create a patchbay with qjackctl and then autostart it from a script.
#!/usr/bin/sh
#create a sink to send streams to multiple output devices.
pactl load-module module-null-sink sink_name=all_devices object.linger=1 media.class=Audio/Duplex channel_map=FL,FR,RL,RR
#connect outputs to sink
pw-jack qjackctl -a patchbay.xml
I would prefer not to omit the gui-elements.
Is there any way to script this in the background without anything popping up?
Last edited by martinbaselier (2020-12-06 23:17:17)
Offline
Haven't dived deep into pipewire yet, does module-combine not work there? from checking the code it really seems to only have a logical mapping for the null sink.
If you have to do this from a jack perspective, maybe see https://askubuntu.com/questions/1153655 … mmand-line for some pointers
---
FWIW it should not be logically possible for pipewire to show the onboard card but pulse randomly "forgetting" about it, they use the literal exact same logic for identifying devices here. The only reason I can see this happening is because pipewire was intermittently started at the same time and grabbing the card away from pulse, so I'm suspecting your original issue would be fixed had you done the reverse and properly stopped pipewire from starting.
Last edited by V1del (2020-12-07 08:28:51)
Offline
null-sink is the only pulseaudio module that is replicated in pipewire: https://github.com/PipeWire/pipewire/bl … ule.c#L146
I think you should be able to use pw-cli and its create-node and create-link commands to set everything up. (or keep null-sink and only use create-link to connect it)
Edit: This might work as well: http://aj-snapshot.sourceforge.net/
Last edited by progandy (2020-12-07 08:29:36)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
FWIW it should not be logically possible for pipewire to show the onboard card but pulse randomly "forgetting" about it, they use the literal exact same logic for identifying devices here. The only reason I can see this happening is because pipewire was intermittently started at the same time and grabbing the card away from pulse, so I'm suspecting your original issue would be fixed had you done the reverse and properly stopped pipewire from starting.
I had the problem before installing pipewire with only pulseaudio. At the same time alsa was showing all my cards. I could send output to it too. The same chip is also responsible for hdmi-audio, which isn't connected. My guess is pulse randomly picked one. I could see a device on that chip with pacmd, but it wasn't available in pavucontrol.
I just found a probable solution to that particular problem in one of the comments on stackexchange.
pactl set-card-profile 0 output:analog-stereo
Anyway because of the lower latency, pipewire has more benefits in my situation. I recently switched to scream on my vm, which improved the sound quality but added latency. Now the latency is fine. When I watch youtube in my vm, audio and video are in sync. And when gaming the audio is perfect. (finally) Before I switched to scream, I always kept hearing these tiny pops and crackles.
Last edited by martinbaselier (2020-12-07 15:20:09)
Offline
Thanks for the tips. Here's my current workaround, for those interested:
After creating the sink, this is the output of pw-jack jack_lsp -c
HyperX Cloud Flight Wireless He:capture_MONO
HDA Intel PCH:monitor_FL
HDA Intel PCH:monitor_FR
HyperX Cloud Flight Wireless He:monitor_FL
HyperX Cloud Flight Wireless He:monitor_FR
all_devices:monitor_0
all_devices:monitor_1
HDA Intel PCH:playback_FL
HDA Intel PCH:playback_FR
HyperX Cloud Flight Wireless He:playback_FL
HyperX Cloud Flight Wireless He:playback_FR
all_devices:playback_0
all_devices:playback_1
So this is the script, I use to create the connections:
#!/usr/bin/sh
pactl load-module module-null-sink sink_name=all_devices object.linger=1 media.class=Audio/Duplex channel_map=FL,FR,RL,RR
pw-jack jack_connect all_devices:monitor_0 HyperX\ Cloud\ Flight\ Wireless\ He:playback_FL
pw-jack jack_connect all_devices:monitor_1 HyperX\ Cloud\ Flight\ Wireless\ He:playback_FR
pw-jack jack_connect all_devices:monitor_0 HDA\ Intel\ PCH:playback_FL
pw-jack jack_connect all_devices:monitor_1 HDA\ Intel\ PCH:playback_FR
Afterwards, this following is added:
all_devices:monitor_0
HyperX Cloud Flight Wireless He:playback_FL
HDA Intel PCH:playback_FL
all_devices:monitor_1
HyperX Cloud Flight Wireless He:playback_FR
HDA Intel PCH:playback_FR
Last edited by martinbaselier (2020-12-07 15:28:02)
Offline
Thanks for the tips. Here's my current workaround, for those interested:
After creating the sink, this is the output of pw-jack jack_lsp -c
HyperX Cloud Flight Wireless He:capture_MONO HDA Intel PCH:monitor_FL HDA Intel PCH:monitor_FR HyperX Cloud Flight Wireless He:monitor_FL HyperX Cloud Flight Wireless He:monitor_FR all_devices:monitor_0 all_devices:monitor_1 HDA Intel PCH:playback_FL HDA Intel PCH:playback_FR HyperX Cloud Flight Wireless He:playback_FL HyperX Cloud Flight Wireless He:playback_FR all_devices:playback_0 all_devices:playback_1
So this is the script, I use to create the connections:
#!/usr/bin/sh pactl load-module module-null-sink sink_name=all_devices object.linger=1 media.class=Audio/Duplex channel_map=FL,FR,RL,RR pw-jack jack_connect all_devices:monitor_0 HyperX\ Cloud\ Flight\ Wireless\ He:playback_FL pw-jack jack_connect all_devices:monitor_1 HyperX\ Cloud\ Flight\ Wireless\ He:playback_FR pw-jack jack_connect all_devices:monitor_0 HDA\ Intel\ PCH:playback_FL pw-jack jack_connect all_devices:monitor_1 HDA\ Intel\ PCH:playback_FR
Afterwards, this following is added:
all_devices:monitor_0 HyperX Cloud Flight Wireless He:playback_FL HDA Intel PCH:playback_FL all_devices:monitor_1 HyperX Cloud Flight Wireless He:playback_FR HDA Intel PCH:playback_FR
I'm looking to solve the exact same problem and came up to your exact solution. In my case I'm using pw-link but the logic is the same:
#!/bin/bash
pactl load-module module-null-sink media.class=Audio/Sink sink_name=Simultaneous channel_map=stereo
pw-link Simultaneous:monitor_FL alsa_output.pci-0000_00_03.0.hdmi-stereo:playback_FL
pw-link Simultaneous:monitor_FL alsa_output.usb-Focusrite_Scarlett_Solo_USB_Y7MBP0G0B6A406-00.analog-stereo:playback_FL
pw-link Simultaneous:monitor_FR alsa_output.pci-0000_00_03.0.hdmi-stereo:playback_FR
pw-link Simultaneous:monitor_FR alsa_output.usb-Focusrite_Scarlett_Solo_USB_Y7MBP0G0B6A406-00.analog-stereo:playback_FR
Is there a way to load it automatically on boot using pipewire configuration files? I spent the whole day reading the documentation but couldn't find much, and loading the script brutally with systemd (as last process) would not work, probably because some audio device is not yet initialized at that point. Is there a "clean" way to load it at boot?
Thanks for the help!
Offline