3 Seconds of HDMI Audio Silence and `session.suspend-timeout-seconds` Not Working

First some hardware specs:

  • CPU: AMD Ryzen 5900X CPU
  • RAM: 32GB of RAM
  • Video: NVIDIA GeForce RTX 4070
  • Sound: NVIDIA GeForce RTX 4070 HDMI Audio

Next come the kernel, Pipewire, and Wireplumber versions, along with the config file for Wireplumber:

[gpeddie-games@epcotcenter ~]$ uname -a
Linux epcotcenter 6.6.6-pikaos #4 SMP PREEMPT_DYNAMIC Tue Dec 12 11:16:44 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[gpeddie-games@epcotcenter ~]$ pipewire --version
pipewire
Compiled with libpipewire 0.3.80
Linked with libpipewire 0.3.80
[gpeddie-games@epcotcenter ~]$ wireplumber --version
wireplumber
Compiled with libwireplumber 0.4.82
Linked with libwireplumber 0.4.82
[gpeddie-games@epcotcenter ~]$ cat .config/wireplumber/main.lua.d/51-disable-suspension.lua 
table.insert (alsa_monitor.rules, {
  matches = {
    {
      -- Matches all sources.
      { "node.name", "matches", "alsa_input.*" },
    },
    {
      -- Matches all sinks.
      { "node.name", "matches", "alsa_output.*" },
    },
  },
  apply_properties = {
    ["session.suspend-timeout-seconds"] = 0,  -- 0 disables suspend
  },
})
[gpeddie-games@epcotcenter ~]$

I’m running PikaOS 3 which is a Nobara-inspired Ubuntu-derived distribution. I’m not sure if a Linux distribution has something to do with it, but for some reason, it seems session.suspend-timeout-seconds has no effect whatsoever.

Back during the old days, PulseAudio makes it easy for me to disable the suspend-on-idle module. I do not know why Pipewire Media Session and now Wireplumber makes it so hard to disable the node suspension so that HDMI audio does not fall asleep and stay awake. Is there anything I can do to disable suspend-on-idle in Pipewire?

Hello everyone. I found a solution that should keep the audio alive on my Linux desktop. The problem seems to do with audio handshake whether you use HDMI or SPDIF or coaxial connection to connect your computer to a home theater receiver for digital audio instead of analog audio connection (sorry, home theater receivers these days do not have 7.1 analog inputs and there’s no such thing as 7.1.4 or 7.1.6 or even 9.1.6 analog inputs for Dolby Atmos; Linux does not support Dolby Atmos anyway).

  1. So I did a search on StartPage:

    Startpage - Private Search Engine. No Tracking. No Search History.

  2. Came across a Reddit thread:

    Fixing the delay when starting audio from Windows over HDMI

  3. I came across the page linked by ncohafmuta:

    Audio Setup Guide | /r/htpc Wiki

  4. I clicked in “these methods” for Linux and scrolled down to see that I can use sox to keep the audio alive:

    Linux USB Audio Keep-Alive Service | Destin Moulton

Instead of “USB Audio Keep Alive,” I would name it “Digital Audio Keep Alive.”

So in .config/systemd/user/digital-audio-keep-alive.service (use your favorite text editor to create a service file), I added in the following (assuming sox is already installed).

[Unit]
Description=Keep Digital Audio Alive Using sox

[Service]
ExecStart=/usr/bin/play -n -c2 synth sin gain -100

[Install]
WantedBy=default.target

I simply refreshed the list of user services, start the service, and enable the service upon boot once all goes well.

systemctl --user daemon-reload
systemctl --user start digital-audio-keep-alive.service
systemctl --user enable digital-audio-keep-alive.service

Everything is now working. What the command play -n -c2 synth sin gain -100 does is it plays a sine wave but keeps the volume at -100 which I believe to be the percentage. The gain is one of the effects for the play command.

Previously, what I tried is this:

[gpeddie-games@epcotcenter ~]$ cat ../gpeddie/bin/create-pa-sink-51surround.sh 
#!/bin/bash
pactl load-module module-null-sink object.linger=1 media.class=Audio/Sink sink_name=pulseaudio-51 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe

In Carla (part of KXStudio applications developed by the user falkTX on LinuxMusicians.org forum)), I simply connected “pulseaudio51” to my NVIDIA HDMI Audio’s 5.1 surround sound. After that, I then changed the output to “pulseaudio51.”

If the TV or monitor is turned off, I will have to reestablish the connection again in Carla in order to get the sound to work without any audio handshake delays when playing sound. The next time I reboot my computer, I will have to execute the script, reconnect in Carla, and change the audio output.

Hopefully my new solution will solve the problem.