How do I disable audio sink suspend on idle using WirePlumber and PipeWire on Fedora 35 so that my audio isn't delayed when playback resumes?

I am using Fedora 35 and there is something that is highly annoying to me with audio. As soon as a song or video stops playing, 3 seconds later the audio sink is suspended and this results in a noticeable delay when starting audio playback again. Before WirePlumber, this delay resulting from suspending of the audio sink could be addressed in a configuration file for pipewire-media-session. There is no documentation as far as I can tell for fixing this problem when using WirePlumber. I discovered that the simple fix is to modify a lua script in the WirePlumber script directory.
cd to /usr/share/wireplumber/scripts/ and make a backup of the file suspend-node.lua somewhere on your system. Then edit the file suspend-node.lua so that one if statement (which contains another if statement and other commands) in part of the contents of the following section in the file are commented out (use Ctrl+m in Gedit if you have the comment plugin installed, or manually do it):

om:connect("object-added", function (om, node)
  node:connect("state-changed", function (node, old_state, cur_state)
    -- Always clear the current source if any
    local id = node["bound-id"]
    if sources[id] then
      sources[id] = nil

    -- Add a timeout source if idle for at least 3 seconds
--    if cur_state == "idle" then
--      -- honor "session.suspend-timeout-seconds" if specified
--      local timeout =
--          tonumber(["session.suspend-timeout-seconds"]) or 3

--      if timeout == 0 then
--        return
--      end

--      -- add idle timeout; multiply by 1000, timeout_add() expects ms
--      sources[id] = Core.timeout_add(timeout * 1000, function()
--        -- Suspend the node
--, "was idle for a while; suspending ...")
--        node:send_command("Suspend")

--        -- Unref the source
--        sources[id] = nil

--        -- false (== G_SOURCE_REMOVE) destroys the source so that this
--        -- function does not get fired again after 3 seconds
--        return false
--      end)
--    end



This completely removes the logic for testing if the sink is idle and suspending it, which is exactly what we want. Reboot your computer and it should be fixed. Enjoy your seamless audio now that your soundcard doesn’t get turned off after 3 seconds! I hope this helps some people on Fedora 35 with their audio playback woes.

Thanks for this. I was getting high-pitched beeps from a speaker connected via digital output whenever it gets suspended. So turning this off is one of the first things I do and Wireplumber shifted the usual files around.

I’ve finally found the proper config file way to set this just like in <34:

Copy 50-alsa-config.lua to your config directory if it doesn’t exist yet:
sudo cp -a /usr/share/wireplumber/main.lua.d/50-alsa-config.lua /etc/wireplumber/main.lua.d/50-alsa-config.lua

Edit the file:
sudo $EDITOR /etc/wireplumber/main.lua.d/50-alsa-config.lua

Under the apply_properties section near the bottom of the file, add ["session.suspend-timeout-seconds"] = 0

The end of that file will now look like this:

apply_properties = {
      --["node.nick"]              = "My Node",
      --["priority.driver"]        = 100,
      --["priority.session"]       = 100,
      --["node.pause-on-idle"]     = false,
      --["resample.quality"]       = 4,
      --["channelmix.normalize"]   = false,
      --["channelmix.mix-lfe"]     = false,
      --["audio.channels"]         = 2,
      --["audio.format"]           = "S16LE",
      --["audio.rate"]             = 44100,
      --["audio.position"]         = "FL,FR",
      --["api.alsa.period-size"]   = 1024,
      --["api.alsa.headroom"]      = 0,
      --["api.alsa.disable-mmap"]  = false,
      --["api.alsa.disable-batch"] = false,
      ["session.suspend-timeout-seconds"] = 0

Save the file and exit the editor.

Restart wireplumber: systemctl --user restart wireplumber

If it’s idle, open the sink by playing some audio and it should properly stay open without idling this time.


Oh that’s definitely a better solution, thanks for figuring that out! I will try doing that instead.

Huge thanks for this solution! I had no idea why my desktop speakers are emitting white noises on Fedora, and this one liner did the trick!