Using Trixie Desktop (RPiOS) and its switch from PulseAudio to PipeWire, there is a way to keep the OS from suspending the audio server (which leads to audible 'pops' when sound clips are played, or noticeable fade in/clipping of the beginning of the audio due to latency with the audio server starting up). Johan has minimized this issue in the code, but a permanent solution is to disable the suspend-on-idle for the output device. PipeWire/WirePlumber defaults to 5 seconds of idle time before shutting down the server.
PipeWire 'pipewire-0' [1.4.2, pi@pi48gb, cookie:2241791311]
└─ Clients:
33. WirePlumber [1.4.2, pi@pi48gb, pid:902]
34. pipewire [1.4.2, pi@pi48gb, pid:903]
47. WirePlumber [export] [1.4.2, pi@pi48gb, pid:902]
84. xdg-desktop-portal [1.4.2, pi@pi48gb, pid:1175]
85. xdg-desktop-portal-wlr [1.4.2, pi@pi48gb, pid:1224]
86. unknown [1.4.2, pi@pi48gb, pid:1078]
87. PipeWire ALSA [python3.13] [1.4.2, pi@pi48gb, pid:1564]
93. wpctl [1.4.2, pi@pi48gb, pid:1735]
Audio
├─ Devices:
│ 48. Built-in Audio [alsa]
│ 49. Built-in Audio [alsa]
│ 50. Built-in Audio [alsa]
│
├─ Sinks:
│ * 35. Built-in Audio Digital Stereo (HDMI) [vol: 0.70]
│ 57. Built-in Audio Stereo [vol: 0.40]
│
├─ Sources:
│
├─ Filters:
│
└─ Streams:
88. PipeWire ALSA [python3.13]
89. output_FL > MAI PCM i2s-hifi-0:playback_FL
[active]
90. output_FR > MAI PCM i2s-hifi-0:playback_FR
[active]
Video
├─ Devices:
│ 43. bcm2835-codec-isp [v4l2]
│ 44. bcm2835-codec-decode [v4l2]
│ 45. bcm2835-codec-encode [v4l2]
│ 46. rpi-hevc-dec [v4l2]
│ 58. bcm2835-codec-image_fx [v4l2]
│ 59. bcm2835-codec-encode_image [v4l2]
│ 60. bcm2835-isp [v4l2]
│ 61. bcm2835-isp [v4l2]
│ 62. bcm2835-isp [v4l2]
│ 63. bcm2835-isp [v4l2]
│ 64. bcm2835-isp [v4l2]
│ 65. bcm2835-isp [v4l2]
│ 66. bcm2835-isp [v4l2]
│ 67. bcm2835-isp [v4l2]
│
├─ Sinks:
│
├─ Sources:
│ * 76. bcm2835-isp (V4L2)
│ 78. bcm2835-isp (V4L2)
│ 80. bcm2835-isp (V4L2)
│ 82. bcm2835-isp (V4L2)
│
├─ Filters:
│
└─ Streams:
Under the Audio section, there are 2 Sinks (I am connected to an HDMI monitor and have selected HDMI on the desktop using the speaker icon, hence the asterisk to the left of ID 35). We need to find the '
node.name' for that sink.
[Note that the other sink (ID 57) is the A/V Jack on the Pi4. If you are using a speaker plugged into that jack, modify these instructions accordingly.]
Enter the command 'wpctl inspect 35'. Here is what I see:
id 35, type PipeWire:Interface:Node
alsa.card = "0"
alsa.card_name = "vc4-hdmi-0"
alsa.class = "generic"
alsa.device = "0"
alsa.driver_name = "vc4"
alsa.id = "MAI PCM i2s-hifi-0"
alsa.long_card_name = "vc4-hdmi-0"
alsa.name = "MAI PCM i2s-hifi-0"
alsa.resolution_bits = "16"
alsa.subclass = "generic-mix"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.sync.id = "00000000:00000000:00000000:00000000"
api.alsa.card.longname = "vc4-hdmi-0"
api.alsa.card.name = "vc4-hdmi-0"
api.alsa.headroom = "0"
api.alsa.path = "hdmi:0"
api.alsa.pcm.card = "0"
api.alsa.pcm.stream = "playback"
api.alsa.period-num = "32"
api.alsa.period-size = "1024"
audio.channels = "2"
audio.position = "FL,FR"
card.profile.device = "1"
*
client.id = "47"
clock.quantum-limit = "8192"
device.api = "alsa"
device.class = "sound"
device.icon-name = "audio-card-analog"
*
device.id = "49"
device.profile.description = "Digital Stereo (HDMI)"
device.profile.name = "hdmi-stereo"
device.routes = "1"
*
factory.id = "19"
factory.name = "api.alsa.pcm.sink"
iec958.codecs = "["PCM"]"
library.name = "audioconvert/libspa-audioconvert"
* media.class = "Audio/Sink"
* node.description = "Built-in Audio Digital Stereo (HDMI)"
node.driver = "true"
node.loop.name = "data-loop.0"
node.max-latency = "16384/48000"
*
node.name = "
alsa_output.platform-fef00700.hdmi.hdmi-stereo"
* node.nick = "MAI PCM i2s-hifi-0"
node.pause-on-idle = "false"
* object.path = "alsa:acp:vc4hdmi0:1:playback"
* object.serial = "58"
port.group = "playback"
* priority.driver = "1000"
* priority.session = "1000"
session.suspend-timeout-seconds = "0"
I highlighted the name we need for the next step.
Create a file called '50-local.conf' in the ~/.config/wireplumber/wireplumber.conf.d/ folder. This folder may not exist so create it:
mkdir -p ~/.config/wireplumber/wireplumber.conf.d
Use nano to create the '50-local.conf' file:
nano ~/.config/wireplumber/wireplumber.conf.d/50-local.conf
Inside the file, place the following 14 lines of text:
monitor.alsa.rules = [
{
matches = [
{
node.name = "~alsa_output.*"
}
]
actions = {
update-props = {
session.suspend-timeout-seconds = 0
}
}
}
]
The tilde (~) at the beginning of the
node.name just signifies a regular expression and allows wildcards (*) to be used. Save (Ctl-o, <Enter>, Ctl-x) and reboot.
The audio should sound better, especially if using SoX as the audio backend.
Randy