Noticeable audio delay or audible pop/crack when starting playback
This is caused by node suspension when inactive.
With wireplumber, create a new file to overwrite the default configuration:
/etc/wireplumber/wireplumber.conf.d/51-disable-suspension.conf (or ~/.config/wireplumber/wireplumber.conf.d/51-disable-suspension.conf)
monitor.alsa.rules = [
{
matches = [
{
# Matches all sources
node.name = "~alsa_input.*"
},
{
# Matches all sinks
node.name = "~alsa_output.*"
}
]
actions = {
update-props = {
session.suspend-timeout-seconds = 0
}
}
}
]
# bluetooth devices
monitor.bluez.rules = [
{
matches = [
{
# Matches all sources
node.name = "~bluez_input.*"
},
{
# Matches all sinks
node.name = "~bluez_output.*"
}
]
actions = {
update-props = {
session.suspend-timeout-seconds = 0
}
}
}
]
Restart pipewire.service and wireplumber.service to apply changes.
Instead of disabling suspension entirely, you can also change the timeout value to the desired number of seconds of delay before source suspension.
Some devices implement their own detection of silence and suspension. For them disabling node suspention alone won't work. It's possible to work around them by adding a small amount of noise, making it so the output never goes fully silent:
.../51-disable-suspension.conf
...
session.suspend-timeout-seconds = 0, # 0 disables suspend
dither.method = "wannamaker3", # add dither of desired shape
dither.noise = 2, # add additional bits of noise
...
It may be neccessary to play with dither.noise and dither.method parameters to make it so the noise is sufficiently silent and simultaneously loud enough to prevent detection of silence. See PipeWire documentation.
With pipewire-media-session:
Disable this by editing /etc/pipewire/media-session.d/*-monitor.conf depending on where the delay occurs and changing property session.suspend-timeout-seconds to 0 to disable or experiment with other values and see what works.
Alternatively you can comment out the line suspend-node in /etc/pipewire/media-session.d/media-session.conf.
Restart both pipewire.service and pipewire-pulse.service to apply these changes, or alternatively reboot.