Skip to content

Audio Device Suspension after Idle

Problem

The problem, if any, is that the audio device is suspended after a while of inactivity.
This results in missing the first second or so of the audio being played to the output.

Solution

Kubuntu 24.04 (wireplumber and pipewire)

As it seems, wireplumber version 0.4.17 uses lua configuraton.
To find the WirePlumber versikon execute wireplumber--version.

Create a file 50-disable-suspend.lua in the user config directory ~/.config/wireplumber/main.lua.d/.

Content of the file has a timeout of 0 seconds which disables the suspension:

table.insert (alsa_monitor.rules, {
  matches = {
    {
      { "node.name", "matches", "alsa_output.*" },
    },
    {
      { "node.name", "matches", "alsa_input.*" },
    },
  },
  apply_properties = {
    ["session.suspend-timeout-seconds"] = 0,
  },
})

Restart the appropriate user-services with comand systemctl --user restart wireplumber pipewire.

Copy and paste this on the command line to make it happen:

mkdir -p ~/.config/wireplumber/main.lua.d/ && 
{ cat <<'EOD' > ~/.config/wireplumber/main.lua.d/50-disable-suspend.lua
table.insert (alsa_monitor.rules, {
  matches = {
    {
      { "node.name", "matches", "alsa_output.*" },
    },
    {
      { "node.name", "matches", "alsa_input.*" },
    },
  },
  apply_properties = {
    ["session.suspend-timeout-seconds"] = 0,
  },
})
EOD
} && systemctl --user restart wireplumber pipewire

Kubuntu > 24.04 (wireplumber and pipewire)

WirePlumber 0.5 has moved away from .lua configuration files to a SPA-JSON format .conf files.
To find the WirePlumber versikon execute wireplumber--version.

Copy and paste this on the command line to make it happen:

mkdir -p ~/.config/wireplumber/main.lua.d/ && 
{ cat <<'EOD' > ~/.config/wireplumber/wireplumber.conf.d/50-disable-suspend.conf
monitor.alsa.rules = [
  {
    matches = [
      {
        node.name = "~alsa_output.*"
      }
    ]
    actions = {
      update-props = {
        session.suspend-timeout-seconds = 0
      }
    }
  }
]
EOD
} && systemctl --user restart wireplumber pipewire

Kubuntu < 20.04 (pulseaudio)

Edit system pulse audio config file editor /etc/pulse/default.pa.

Comment the next line out like this:

### Automatically suspend sinks/sources that become idle for too long
# Removed to fix delay in sound on display port.
#load-module module-suspend-on-idle

To make it have an effect without restarting, just kill the pulse daemon which restarts itself.

pulseaudio --kill