Pipewire, pro-audio, default sink/source
Updated at by ospiA bit of continuation for my previous post. As pro-audio mode skips creating mixers for inputs and outputs and there are no channels maps, a pulseaudio client like Chrome will just use stereo input for microphone. On my system this would be guitar DI in left ear and microphone on right ear :) So I created another loopback device for the microphone used mostly by pulseaudio clients like Chrome, Discord and games.
~/.config/pipewire/pipewire.conf.d/loopback.conf
context.modules = [
{ name = libpipewire-module-loopback
args = {
node.name = "ssl"
capture.props = {
media.class = "Audio/Sink"
audio.position = [ FL FR ]
}
playback.props = {
audio.position = [ FL FR ]
stream.dont-remix = true
node.passive = true
node.autoconnect = false
}
}
}
{ name = libpipewire-module-loopback
args = {
node.name = "mic"
capture.props = {
audio.position = [ AUX1 ]
target.object = "alsa_input.usb-Solid_State_Logic_SSL_2_-00.pro-input-0"
stream.dont-remix = true
node.passive = true
}
playback.props = {
media.class = "Audio/Source"
audio.position = [ MONO ]
# Prevent apps like Chromium/Chrome fiddling with the volume if clipping
channelmix.lock-volumes = true
}
}
}
]
The target.object
is the node.name
shown with wpctl inspect <id>
for input device and audio.position
starts from [AUX0]
.
After pipewire restart, the loopback is visible on wpctl status
with the given node.name
. Setting default with wp-ctl set-default 39
and voila.
Audio
├─ Devices:
│ 58. SSL 2+ [alsa]
├─ Sources:
│ * 39. mic [vol: 1.00]
│ 98. SSL 2+ Pro [vol: 1.00]
And in the bottom.
Settings
└─ Default Configured Node Names:
0. Audio/Sink input.ssl
1. Audio/Source output.mic
Also a script which toggles connections from the loopback stereo sink to either AUX0+AUX1 or AUX2+AUX3 or both.
#!/bin/bash
case "${1}" in
aoff)
pw-link -d output.ssl:output_FL alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX0 2> /dev/null
pw-link -d output.ssl:output_FR alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX1 2> /dev/null
pw-link -d output.ssl:output_FL alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX2 2> /dev/null
pw-link -d output.ssl:output_FR alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX3 2> /dev/null
;;
1on)
pw-link output.ssl:output_FL alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX0 2> /dev/null
pw-link output.ssl:output_FR alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX1 2> /dev/null
;;
2on)
pw-link output.ssl:output_FL alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX2 2> /dev/null
pw-link output.ssl:output_FR alsa_output.usb-Solid_State_Logic_SSL_2_-00.pro-output-0:playback_AUX3 2> /dev/null
;;
*)
exit 0
;;
esac