PipeWire/サンプル

提供: ArchWiki
2023年4月6日 (木) 13:19時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (英語版より新規作成)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

関連記事

Surround sound systems

Splitting front/rear

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 [1]. However, you may use it to unload all module-null-sink modules using pactl unload-module module-null-sink.

Using jack_connect, connect the monitors of the new sinks to the sound card's playback ports. Find out the name of the channels by running pw-link -iol[2].

 pw-link speakers:monitor_1 alsa_output.pci-0000_00_14.2.analog-surround-40:playback_FL
 pw-link speakers:monitor_2 alsa_output.pci-0000_00_14.2.analog-surround-40:playback_FR
 pw-link headphones:monitor_1 alsa_output.pci-0000_00_14.2.analog-surround-40:playback_RL
 pw-link headphones:monitor_2 alsa_output.pci-0000_00_14.2.analog-surround-40:playback_RR
ヒント: Add the above commands to a script and autostart it to automate the process. Be sure to replace alsa_output.pci-0000_00_14.2.analog-surround-40 with the name of your sound card. Adding a delay before the script executes may also make things work smoother.
ノート: The Jack/Pipewire sinks seem to change name now and then. In the above example, alsa_output.pci-0000_00_14.2.analog-surround-40:playback_FL sometimes changes into Built-in\ Audio\ Analog\ Surround\ 4.0:playback_FL. As a quick workaround, you could add a second set of pw-jack commands 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.