Could we help you? Please click the banners. We are young and desperately need the money
Are you experiencing frustrating audio issues on your Ubuntu or Linux Mint system? Short sounds like notification alerts not playing, or experiencing delays in audio playback? You're not alone. This comprehensive guide will walk you through a common problem with the Pipewire audio server and provide a step-by-step solution to fix these annoying audio glitches.
Before we dive into the solution, let's briefly explain what's causing this issue:
The root of the problem lies in Pipewire's default behavior: it's configured to enter suspend mode after just 5 seconds of inactivity. While this might seem like a good idea for power saving, it can cause short sounds (like notification alerts) to be cut off or not play at all.
This default setting leads to two main issues:
These problems can be particularly annoying for users who rely on audio cues for notifications or those who frequently start and stop audio playback.
To resolve this issue, we need to modify the Wireplumber configuration to either disable the suspend functionality entirely or set a much longer timeout. Here's how to do it:
First, we need to create a new configuration file in your user directory. This ensures our changes won't be overwritten by system updates.
mkdir -p ~/.config/wireplumber/main.lua.d/
nano ~/.config/wireplumber/main.lua.d/50-disable-session-suspend.lua
In the newly created file, add the following content :
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"] = 86400, -- 0 disables suspend - on some systems this won't work and you need to set a high value like 86400 (1 day) instead
},
})
This configuration sets the suspend timeout to 86400 seconds (24 hours), effectively preventing the audio server from entering suspend mode during normal usage. Check if the name of your Sink is also starting with "alsa_output" since the rules in the code above are programmed to match all sinks starting with "alsa_output". You might need to change that on your system. See Verifying the Fix chapter below for more information.
After saving the file, you need to restart the Pipewire and Wireplumber services to apply the changes:
systemctl --user restart pipewire wireplumber
To check if the fix has been applied successfully, you can monitor the status of your audio sinks using the following command:
watch -cd -n .1 pactl list short sinks
This command will continuously update and show the status of your audio sinks. You should see "IDLE" instead of "SUSPENDED" for your audio devices.
While this solution effectively resolves the audio delay and missing notification issues, there are a few points to consider:
This solution has been tested by us and confirmed to work with:
While primarily observed in GNOME/X11 environments (the standard Linux Mint desktop), this issue and its solution may also apply to KDE and Wayland-based systems, as the root cause lies within the Pipewire audio server itself.
If you're still experiencing problems after applying this fix, consider the following troubleshooting steps:
systemctl --user status pipewire
to check if Pipewire is running correctly.By adjusting the Pipewire and Wireplumber settings as described in this guide, you should now be able to enjoy uninterrupted audio playback and timely notification sounds on your Ubuntu or Linux Mint system. This fix addresses a common frustration for many Linux users and demonstrates the flexibility and configurability of open-source audio solutions.
Remember, while this solution works for many users, audio configurations can be complex and vary between systems. If you continue to experience issues, don't hesitate to seek help from the Ubuntu or Linux Mint community forums.
We hope this guide has helped you resolve your audio issues and improved your Linux experience. Happy listening!