PipeWire: Difference between revisions
My first edit on this wiki! I struggled quite a bit with configuring wireplumber to fix an issue that i've seen a ton of people deal with, about wireplumber switching modes when you'd least want it to, causing all sorts of interference. Disabling that function on Nix is an easy one liner, but takes a lot of effort to get there through heaps of documentation. So i decided to add the code snippet. Also fixed an error and mentioned that .lua files have been scrapped in wireplumber 5.0. :D |
Explain how to disable sink suspension in wireplumber to avoid sound pops. |
||
Line 238: | Line 238: | ||
* Run {{ic|pavucontrol}}, navigate to the configuration tab, and set the Profile for STUDIO-CAPTURE (or your audio interface) to "Pro Audio". | * Run {{ic|pavucontrol}}, navigate to the configuration tab, and set the Profile for STUDIO-CAPTURE (or your audio interface) to "Pro Audio". | ||
* Ensure the audio interface and Ardour are set to the same sample rate. Ardour8 will accept a configuration where its sample rate does not match the audio interface's sample rate, when using PipeWire, but will not actually be able to record audio unless they match. If you are unable to successfully activate a track's record button, this may be the issue. | * Ensure the audio interface and Ardour are set to the same sample rate. Ardour8 will accept a configuration where its sample rate does not match the audio interface's sample rate, when using PipeWire, but will not actually be able to record audio unless they match. If you are unable to successfully activate a track's record button, this may be the issue. | ||
=== Sound pops a few seconds after playback stops === | |||
By default Wireplumber suspends a sink after 5 seconds of no playback which can create a sound pop on sensitive audio equipment. You can disable this by providing extra configuration to wireplumber but first you need to find out the name of the problematic sink in the wireplumber namespace. | |||
<ol> | |||
<li>'''Find out the name of the sink''' | |||
<ol> | |||
<li>Run <code>pw-top</code> to monitor pipewire processes</li> | |||
<li>Play and pause sound on the problematic device. After 5 seconds the numeric columns of at least one process will disappear. This is the suspension in action. You need the value of the NAME column to refer to this sink in the configuration below. Since the display updates each second, you can't copy the value easily. Rerun <code>pw-top -b</code> and abort with <kbd>CTRL</kbd>+<kbd>C</kbd> to get persistent output.</li> | |||
</ol> | |||
</li> | |||
<li>'''Add configuration''': | |||
Assuming the value of the NAME column was <code>alsa_output.usb-ASUSTeK_Xonar_SoundCard-00.iec958-stereo</code>, add the following Nix configuration: | |||
<syntaxhighlight lang="nix"> | |||
# Disable suspend of Toslink output to prevent audio popping. | |||
services.pipewire.wireplumber.extraConfig."99-disable-suspend" = { | |||
"monitor.alsa.rules" = [ | |||
{ | |||
matches = [ | |||
{ | |||
"node.name" = "alsa_output.usb-ASUSTeK_Xonar_SoundCard-00.iec958-stereo"; | |||
} | |||
]; | |||
actions = { | |||
update-props = { | |||
"session.suspend-timeout-seconds" = 0; | |||
}; | |||
}; | |||
} | |||
]; | |||
}; | |||
</syntaxhighlight> | |||
The value 0 disables suspension entirely. You could also set it to a higher value. 5 (seconds) is the default value. | |||
</li> | |||
<li>'''Verify resolution''': | |||
After switching to the new configuration you need to also run <code>systemctl --user restart wireplumber</code> as your non-root user to apply the new wireplumber configuration, since wireplumber runs as your non-root user - <code>nixos-rebuild switch</code> is not sufficient. Play and pause sound again and verify that no sound pops occur anymore and observe in <code>pw-top</code> that the numeric columns for that sink do not disappear after 5 seconds. | |||
</li> | |||
</ol> | |||
==See also== | ==See also== |