This week I began using my laptop as a battlestation by connection external monitors, keyboard, mouse, microphone, and speakers. The only real headache was that every time I received a chat notification there was a loud popping sound from the speakers, then the audio playback, then another loud popping sound. A bit of searching turned up the root cause–power saving in the sound system–but finding the fix was a bit tricky.
Obvious Solutions that Don’t Work
There are a few obvious solutions that didn’t work for me. The first is to
disable power-saving in the TLP daemon.
However, running systemctl status tlp shows that there is no tlp.service
enabled.
Several search results pointed to the module itself causing the popping, once
again due to power-saving. However, when investigating the
module, I found that
power_save is already set to 0 for the snd_hda_intel module.
I also found several references to disable
power-saving
using an alsa-base.conf overlay file. However, using this approach had no
effect.
Solution: Disable Alsa Power Saving Using Pipewire and Wireplumber
I found the solution through a combination of the Pipewire and Arch docs.
First, the example alsa configuration in the Pipewire
docs
shows how to set the suspend-timeout-seconds value. While the example shows a
setting of 5, when researching the issue I previously discovered that setting
it to 0 disables power-saving.
The Arch docs show how to add a Wireplumber overlay to set your preferred alsa values. We need to create a directory, then set the overlay file.
-
Create the Wireplumber directory
sudo mkdir -p /etc/wireplumber/wireplumber.conf.d -
Add the overlay file
sudo touch /etc/wireplumber/wireplumber.conf.d/disable-suspend.conf -
Add configuration to the overlay file
monitor.alsa.rules = [ { matches = [ # This matches the value of the 'node.name' property of the node. { node.name = "~alsa_output.*" } ] actions = { # Apply all the desired node specific settings here. update-props = { session.suspend-timeout-seconds = 0 } } } ] -
Restart Wireplumber
systemctl --user restart wireplumber
You will hear a few pops when Wireplumber restarts (and when first booting your machine), but the pops at the beginning and end of each audio output will be resolved.
Tricky Configuration
This one was a bit tricky to track down, mostly because I was unable to find a default setting for this on the laptop itself. I would prefer that a default setting be easily found for each configurable option. Either that’s not how Wireplumber works, or I was just looking in the wrong place. But now I can work for hours on end with pop-free audio!