Surround sound systems
When using PipeWire as a PulseAudio/JACK replacement, you can set up Pipewire to replicate the Pulseaudio example for splitting front/rear. Doing this allows you to send audio streams using Pulseaudio to a separate sink for speakers or headphones.
Connect speakers to the line-out port and headphones to the rear port. In
pavucontrol set the soundcard used to Analog Surround 4.0 Output. Then using the following commands, make new sinks for the speakers and for the headphones, link the speakers to the front channels and link the headphones to the rear channels:
pactl load-module module-null-sink sink_name=speakers object.linger=1 media.class=Audio/Sink channel_map=FL,FR pactl load-module module-null-sink sink_name=headphones object.linger=1 media.class=Audio/Sink channel_map=RL,RR
object.linger=1 keeps the sinks alive after the creating client disconnects. You can name
sink_name whatever you want.
In order to unload module, you can use
pw-cli destroy ID, where
ID is output of
pactl load-module command. Unloading individual modules through
pactl unload-module is not currently supported . However, you may use it to unload all
module-null-sink modules using
pactl unload-module module-null-sink.
jack_connect, connect the monitors of the new sinks to the sound cards playback ports. Find out the name of the channels by running
pw-jack jack_connect speakers:monitor_0 HDA\ ATI\ SB:playback_FL pw-jack jack_connect speakers:monitor_1 HDA\ ATI\ SB:playback_FR pw-jack jack_connect headphones:monitor_0 HDA\ ATI\ SB:playback_RL pw-jack jack_connect headphones:monitor_1 HDA\ ATI\ SB:playback_RR
HDA\ ATI\ SBwith the name of your sound card.
HDA\ ATI\ SB:playback_FLsometimes changes into
Built-in\ Audio\ Analog\ Surround\ 4.0:playback_FL. As a quick workaround, you could add a second set of
pw-jackcommands in your autostart script with the second set of names.
To individually control the volumes, one option is to use alsa utilities (such as amixer) to control Front and Rear/Surround (alsa naming) channels. A script to automatically do that depending on what is your currently default pulseaudio sink can be found here.