21

I have recently switched over to Ubuntu 24.04 and I hear crackling sounds more often why is it and how can I fix it?

Emanuele
  • 1,124

13 Answers13

30

The likely issue for crackling sounds on Ubuntu 24.04 is that the distro has been switching over to pipewire and it runs a conversion service from pulse audio, namely pipewire-pulse.

The challenge is that many apps don't directly talk to piepewire, but do it through JACK and/or especially pulse itself, hence sound data needs to be moved though additional hops.

The default time buffers for pipewire-pulse is 2.7 ms, which means that an application needs to be able to fill sound content every 2.7 ms, otherwise pipewire will send to the audio device whatever was previously filled and potentially some random data, hence the crackling.

2.7 ms is quite a stringent time, especially for applications which don't have dedicated threads for audio (likely Proton/wine/games) and/or when running on old CPUs - hence one way to limit cracking is to tell pipewire-pulse to set a larger time buffer, albeit adding a delay to when the sound is sent to the audio device.

In order to do so, one needs to open the file:

/usr/share/pipewire/pipewire-pulse.conf

And then find, uncomment and change the configuration for the item:

pulse.min.quantum      = 128/48000     # 2.7ms

from he value 128 to something larger - one should try 256 or even 512 as a starting point and if they experience no crackling they should leave as is (please note that after saving the file, one has to restart pipewire, pipewire-pulse via systemctl --user restart wireplumber pipewire pipewire-pulse).

The key is to find the smallest number so that the annoying crackling is not present (or at an acceptable minimum), because if larger numbers (such as 1024) make very little crackling happen, they add a delay (1024 / 48000 -> 21.333 ms).

Slower CPUs will need numbers as 512 or higher, or when using multiple software keeping the CPU busy, it's likely that a number such as 1024 or even 2048 may be beneficial.

Please note that crackling is by default (128/48000) noticeable on a 5950x (32 cores/16 threads) with 64 GiB of ram, hence it's likely much more noticeable on less powerful CPUs.

As a side note, not sure why/how Canonical/Ubuntu have decided to ship this stringent config, looking at how many threads complaining about crackling are pervasive on this forum and others.

Emanuele
  • 1,124
  • Can you qualify "Please note that crackling is by default (128/48000) noticeable on a 5950x (32 cores/16 threads) with 64 GiB of ram, hence it's likely much more noticeable on less powerful CPUs." How do you know? Like you said, it seems stringent, and with those numbers, nowhere near realistic. – Tyler Collier Sep 11 '24 at 21:56
  • 4
    Note that as mentioned in that file, one is supposed to make a custom version in /etc/pipewire or ~/.config/pipewire rather than editing /usr/share/pipewire/pipewire-pulse.conf. – ysalmon Sep 24 '24 at 08:19
  • @ysalmon, Works, ref: https://www.reddit.com/r/linux_gaming/comments/1d1ef61/pipewire_audio_distortion_and_crackling_fix/ but temporarily, jumping back/forward in a video playback the noise comes back. – Bug Oct 08 '24 at 05:54
  • solution doesn't fully fix the problem. Still very annoying. – Alok Kumar Oct 25 '24 at 03:45
  • 1
    Tried step by step up to 2056 and didn't work… (Intel i7 7thGen laptop) – FairMiles Nov 08 '24 at 20:35
  • Finding this setting to 2048 may have solved it for me... https://askubuntu.com/questions/1514900/ubuntu-24-04-sound-issues-zoom-lenovo-ideapad-laptop – Amos Folarin Dec 18 '24 at 09:35
  • "And then find, uncomment and change the configuration for the item:" Right here is where a screenshot would have been nice cause I'm not sure what exactly you're talking about here, I'm a newbie and I get so confused with this stuff. I'm a visual learner so please take a screenshot so I can see what it is you're talking about. Man this stuff is just so complicated to me. I'm a newbie and I can't understand what to do here. I need screenshots. I'm a visual learner. – James1 Dec 28 '24 at 06:04
  • @James1 Lines in a system file with a # as the first character indicate a comment. You just delete the character to make the line active and follow the other instructions provided. – graham Dec 28 '24 at 08:51
  • @graham You computer experts seem to forget that the vast majority of PC users really only know how to turn on a PC and open up a web browser and browse the web and that's it. Your average PC user wouldn't even know what a "command line" is. I am your average PC user and I need to see screenshots, I'm a visual learner, don't tell me, just take a screenshot and show me. Please walk me through this step by step? You coders and programmers need to remember, most PC users are dumb compared to you. – James1 Dec 28 '24 at 08:59
  • I'm an average PC user just like you. Time to learn like we all had to do in the beginning of our Linux journey. I gave you a link to understand how to use Nano earlier. If you use Nano without sudo privileges , you will be able to see the file without altering it which might increase your confidence. Make a backup of important data and be prepared to reinstall Ubuntu if you brick your system. It's good learning practice Bonne chance! – graham Dec 28 '24 at 10:55
  • Emanuele, when you say "And then find, uncomment and change the configuration for the item:" when you say uncomment do you mean deleting the # ? When I'm done editing the line do I add the # back? You've got to understand there are newbies here, this stuff is so confusing to me. I need detailed step by step instructions or else I will get confused. I'm a newbie I don't know what I'm doing. Explain it to me like I'm a 5 year old child? Thank you. – James1 Jan 15 '25 at 20:28
  • 1
    I was only getting crackling under high CPU loads (>60%), and this fixed the problem for me. Based on my symptoms, this explanation makes checks out. The short default buffer of 2.7ms makes sense to me, since you really want as close to zero latency as possible, with anything higher being a compromise. – drmuelr Feb 16 '25 at 18:57
  • Thanks for mentioning "Ubuntu 24.04 is that the distro has been switching over to pipewire"! Makes me wonder if there are millions out there who have/had this issue... – sjngm Mar 21 '25 at 23:25
  • I set pulse.min.quantum to 1024/48000 instead of 128/48000 and the crackling seems to be gone for me, I went from Ubuntu 22.04 to Ubuntu 24.04 today, I have Sennheiser 350BT headphones using aptX at 60% volume. Weirdly enough, they seem to set it to 1024/48000 by default for VMs, so it seems like they aren't being aggressive enough with that number and they need to increase it more by default outside of VMs. Maybe 2048 in a VM and 1024 outside of a VM. Thanks for the solution! I bet there are many more of us with this issue, they should really fix the default value. – ipkpjersi Jun 30 '25 at 02:22
  • Oh, it's too late for me to edit my comment now, but I should mention that I have an R9 5900x and 32GB of RAM, 2TB NVMe SSD, RTX 4070 if that matters, and the 1024/48000 value seems to work well for me. – ipkpjersi Jun 30 '25 at 02:41
  • The crackling started again today, and I took a look and saw that pulse.min.quantum was back to 128/48000 so that means two things. 1) I guess it resets back to the original config sometimes probably on updates although I don't see anything pulse or pipe was updated in my recent logs 2) They have decided that 2.7ms is still a sensible default time regardless of what CPU people use or what their workload is like and they haven't changed it. This time I had to even reboot my entire PC not just pulse/pipe/etc after changing the config for the crackling to go away but it's all good now once again. – ipkpjersi Aug 09 '25 at 16:03
5

I searched again for kernel 6.8 and ati sound issues , i read this https://bbs.archlinux.org/viewtopic.php?id=294114 and run these commands

wpctl clear-default  
systemctl restart --user pipewire

So far it seems to have resolved the issue. Others in this forum post agree , something to do with wireplumber. 10 mins after still no issues with sound on videos , checked also the HDMI output. UPDATE: Unfortunatelly , after 1 day problem appeared again.

  • 1
    Thanks, This works, but temporarily only. Jumping forward or return in a video (Youtube or anything else) the noise comes back. It also happens wen starting/restarrting skype and also making a screendump (after the camera sound) – Bug Oct 08 '24 at 05:51
  • This seems to have worked in my case, at least for a short term - still testing it. I had an issue where the sound was fine until I connected bluetooth earbuds (technics eah-az80), then system switches to the earbuds and on the earbuds you can hear the music desynchronizing, crackling and then stopping - no more audio output goes through the headphones. The only solution was to 2x change the configuration in the Settings - Sound - Configuration dropdown to the chosen profile. I'll test this solution a bit more. Thanks! – synweap15 Nov 19 '24 at 07:29
  • Driving me bonkers. I tried pulse.min.quantum changes but it didn't work. I've just tried this solution here and confirm this worked for me (for now). Will see how long for – Amos Folarin Dec 17 '24 at 14:08
  • No still having me the same issue.. :( – Amos Folarin Dec 18 '24 at 09:07
4

The accepted answer from @Emanuele works for me on Linux Mint 22 (Ubuntu 24.04).
It's surprising that it has 0 votes. Due to not enough 50 reputations, I cannot comment or upvote, so I am writing this here so that others know the solution is worth trying.

I created a small script to automate the solution:

# copy the default config to `/etc/pipewire` for editing
export newConf=/etc/pipewire/pipewire-pulse.conf
sudo mkdir -p $(dirname $newConf)
sudo cp /usr/share/pipewire/pipewire-pulse.conf $newConf

uncomment and change the value from 128 to 1024

sudo sed -i.bak 's/#pulse.min.quantum = 128/48000 # 2.7ms/pulse.min.quantum = 1024/48000/' $newConf

check if the sed command successfully changed the config, log should show 1024

cat $newConf | grep "pulse.min.quantum"

after changing the config, restart the audio services

systemctl --user restart wireplumber pipewire pipewire-pulse

I restart the computer too

  • Tung Dao Thanh Tung How do I do this exactly? I'm a newbie I'm not sure what to do here, so do I just copy all that script and paste it as is into my terminal and hit enter? – James1 Dec 28 '24 at 05:58
  • @James1 yes, you do copy to the terminal and enter, it will ask you for password for sudo, because it needs to creates a config file in /usr/share/ – Tùng Đào Thanh Tùng Dec 29 '24 at 12:27
  • Tung Dao Thanh Tung, can you be more specific please? I'm a newbie. Can you please tell me step by step what I need to do here? I don't want to brick my computer. – James1 Jan 02 '25 at 06:02
  • @James1 you just copy all of my script, paste to your terminal, then press enter, not sure how can I be more specific you can ask ChatGPT to explain each command meaning. – Tùng Đào Thanh Tùng Jan 03 '25 at 07:15
  • Thanks for the script. I'm glad you copied the config into /etc/pipewire instead of editing /usr/share/pipewire/pipewire-pulse.conf directly. – Kyler Johnson Aug 27 '25 at 11:30
1

I was on Ubuntu 22.10 to 23.10 with kernel up to 6.11 w/o cracking problems. The problem started after exactly after upgrading to Ubuntu 24.04. The tool helps once, but the pause a Youtube video and start again or making s screendump(camera sound) the cracking noise comes back again. PW may work for on board CODECS but external usb audio devices seems not well supported, in the past 10 years before PW, could run 5 to 8 msec with 3 buffers in Jack2. Now it needs at least 512 bytes. I am running the Pro audio profile.

Also when I switch on my USB interface while Ubuntu is running it does not see the device. No one else has PW issues like these ? Is there any issues tracking this ?

Bug
  • 97
  • Just restart PW, seems to be enough. The key question why does this happen with PW and not Jack/Pulse audio and specially starting with 24.04 ? Ubuntu 24.10 has the same result. – Bug Nov 01 '24 at 14:21
  • I already had the cracking on Ubuntu 23.10. Pipewire is the fault. – Tom Dec 22 '24 at 11:53
  • @Tom how did you fix the crackling? I'm having the same issue on 24.04 LTS and I can't fix it, I'm either gonna have to go back to 22.04 LTS or I might just jump over to Mint and see what it's like on the other side of the fence. – James1 Jan 02 '25 at 06:04
  • Any change you could try kernel 6.12 or 6.13 or wait for Ubuntu 25.04 that will have a newer kernel. – Bug Jan 04 '25 at 14:55
  • @James1 I reverted to Ubuntu 20.04 on my other computer and Debian 12 on the virtual machine. – Tom Jan 04 '25 at 17:03
  • @Bug Are you talking to me? – James1 Jan 15 '25 at 03:04
  • @Tom So you weren't able to fix this sound issue on Ubuntu 24.04 LTS? I can't fix it and I'm probably going to jump over to Linux Mint. This is so frustrating. – James1 Jan 15 '25 at 03:05
1

Kernel 6.13 seems to solve this issue. No more noise on the USB audio interface. :-)

Bug
  • 97
1

Ubuntu 24.04 switched to PipeWire as the new default sound system. It's meant to be an improvement, but like any big change, sometimes it needs a little tweaking with certain hardware or existing configs, which can lead to issues like crackling.

here are a few things you can try (kinda in order of simplest first):

Basic Checks (Don't skip these!):

Make sure your system is fully updated: sudo apt update && sudo apt full-upgrade then sudo reboot. sometimes it's just a pending update...

Go into Ubuntu's "Sound" settings and try switching your "Output Device" to something else, then back to your main one. Sounds silly, but it can kick things back into place.

Update PipeWire & WirePlumber via PPA : The versions in the main Ubuntu repos might not be the absolute latest. Newer versions often have bug fixes for these kinds of issues.

sudo add-apt-repository ppa:pipewire-debian/pipewire-upstream && sudo add-apt-repository ppa:pipewire-debian/wireplumber-upstream && sudo apt update && sudo apt full-upgrade

Then reboot.

Adjust PulseAudio Config : PipeWire has a compatibility layer for PulseAudio, so these settings can still help.

First, back up the file: sudo cp /etc/pulse/daemon.conf /etc/pulse/daemon.conf.bak

Then edit it: sudo nano /etc/pulse/daemon.conf

Find these lines (they might be commented out with a ; or #), uncomment them, and set them like this:

default-sample-format = float32le default-sample-rate = 48000

Save the file and reboot. This can sometimes smooth out quality issues.

Install pavucontrol (PulseAudio Volume Control):

sudo apt install pavucontrol

Run pavucontrol.

It gives you much finer-grained control than the default sound settings. Check the "Configuration" tab for your sound card and see if different profiles make a difference. Also, check the "Output Devices" tab to ensure the correct port is selected (e.g., "Line Out" vs "Headphones" if they are separate and one is noisy).

Zezo 52
  • 11
  • 1
0

In Ubuntu 24.04 (at least) there is now a utility "Ubuntu Studio Audio configuration" For me 48000 512 with external USB 2.0 audio interface worked. You can could also try install low latency kernel to get lower latency

Well, it works sort of... when going back or forward in videos the noise is coming back.

Bug
  • 97
0

The problem is caused by the kernel 6.8. Downgrading to previous version solves it.

lboullo0
  • 101
0

Just compiled kernel 6.12-rc1 with the new feature REALTIME kernel. It is stable and it reduces latency from 1024 to 256. 128 sample size is causing distortion. It's a bit better but it's still probably and best case 16msec latency (assume it's 3 buffers, can't tell) which is still unacceptable for audio production. (that is a direct monitoring headphone on the USB device will have a significant difference versus the audio from the USB host). and it still often come back making a screenshot or jumping forward or back while a playing video. 9using a USB 2.0 audio interface)

24.10 same result. (PREEMPT_REALTIME and PREEMPT_DYNAMIC)

Bug
  • 97
0

Issue seems to be with Ubuntu Kernel see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2091565

echo "options snd-hda-intel snoop=0" | sudo tee /etc/modprobe.d/hdmisoundfix.conf sudo update-initramfs -u -k all

Fix I think is pending but for now above worked for me...

Amos Folarin
  • 1,244
  • Great find, Now on 6.14-rc1 and haven't seen the issue since 6.12. did not apply this fix. Some post in this thread I posted had been deleted by the moderator and SE does not allow to undelete them. So the context of this thread may not be so clear. – Bug Feb 16 '25 at 01:58
0

Issue is with Linux kernel see solution here re setting kernel opt snoop=0 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2091565

Amos Folarin
  • 1,244
  • 1
    This bug is specific for AMD GPU. I am using Intel and I have the same random crackling sound issue. – Dherik Mar 28 '25 at 19:39
0

I had this problem on the 24.04 Ubuntu Unity flavor but on the HDMI audio only, no crackle on USB audio. ATI Tobago HDMI Audio in use.

Strangely, systemctl status --user pipewire revealed that pipewire was not running. So I decided to restart pulseaudio and this fixed the problem (the crackling was gone):

systemctl restart --user pulseaudio

On a side note, selecting the HD 5.1 HDMI profile from the Configuration tab of pavucontrol substantially reduced, but did not completely eliminate the crackling. But restarting the pulseaudio service fully fixed the problem (as of now).

mchid
  • 45,159
  • I have ran into this problem a handful of times, always running a live usb session, and restarting pulseaudio fixes the problem every time. – mchid Jun 18 '25 at 08:29
  • "always running a live usb session, and restarting pulseaudio fixes the problem every time." I'm sorry you have to go into a live USB Ubuntu session to fix it? What you mean exactly here? Also, hey listen, so follow this link and read this thread https://forums.linuxmint.com/viewtopic.php?t=445591 in particular read the the very last post in that thread cause I think that might help you, have you tried that yet? It worked for me, it solved the audio bug that cropped up back in December for me. – James1 Jun 18 '25 at 18:49
  • @James1 Thanks but actually, this problem has only occurred while running the live session. This computer has no dedicated hard drive or ssd and we primarily use it as a family computer to stream television (watch Jeopardy) at the dinner table. – mchid Jun 18 '25 at 19:22
  • Why don't you have a hard drive in your computer? Also, hey listen, so follow this link and read this thread https://forums.linuxmint.com/viewtopic.php?t=445591 in particular read the the very last post in that thread cause I think that might help you, have you tried that yet? It worked for me, it solved the audio bug that cropped up back in December for me. I'm on Ubuntu 24.04 LTS there was a nasty audio bug back in December that affected certain AMD GPUs. In fact, for my PC it was never fully fixed, just read that thread thoroughly. – James1 Jun 18 '25 at 19:28
  • @James1 The old SSD failed and we haven't got around to buying a new one because running from the Live session seems to work well for just streaming television. It usually runs for weeks and months at a time without reboot and only freezes up occasionally (like if I try to run firefox and chrome at the same time with gimp). But yes, I usually install the HWE kernel after installing Ubuntu and I will keep that configuration change in mind when I get around to buying a new SSD. – mchid Jun 18 '25 at 19:39
  • "But yes, I usually install the HWE kernel after installing Ubuntu" no you're not understanding me at all, follow this link https://forums.linuxmint.com/viewtopic.php?t=445591 and scroll all the way down to the bottom and read the very last comment, see what @ seasons told me to do. Do what @ seasons told me to do to fix my audio bug, does it work for you? – James1 Jun 18 '25 at 21:10
  • Also hey mchid, I left a couple of comments here for you to read and hopefully you'll respond https://askubuntu.com/questions/1550871/how-do-i-install-whonix-on-ubuntu-24-04-lts do you think you could go into "Method 2" and tell us how to verify the Whonix ova before we import it into VirtualBox? Do you know how to do that? Thanks and I do appreciate the help. – James1 Jun 18 '25 at 21:14
  • @James1 To do what seasons suggests on a live session, you'd have to echo "options snd-hda-intel snoop=0" | sudo tee /etc/modprobe.d/hdmisoundfix.conf and then use sudo modprobe -r snd-hda-intel and then sudo modprobe snd-hda-intel to apply the configuration options although I have a feeling the moodprobe -r might fail because it looks like the snd-hda-intel module is in use by 3 but it doesn't list what's using it if we run lsmod | grep "snd.hda.intel". After I do a full install I will try this but until then, I can simply restart PulseAudio to fix the issue as it rarely happens. – mchid Jun 18 '25 at 22:10
0
  1. For external USB Pro-card this helped me: pavucontrol → tab «Configuration» → chose “Pro Audio”

This also could be done via command line.


  1. OR sometimes this could help as well: If the Sound Settings window is opened (even minimized), the crackling disappears. When that window is closed, the crackling comes back. It is back after every output device switching, then do

    systemctl --user restart wireplumber pipewire pipewire-pulse

The same thing happens when there is heavy traffic to or from the GPU - while the GPU is busy the crackles vanish, and they return as soon as the load stops. But this is just quick temporary workaround.

  • Why this works (guessing): When the Sound Settings application is running it holds an active audio stream to the sink for sound level indicator. That prevents PipeWire from putting the sink into a suspended state. Closing the dialog releases the stream, PipeWire suspends the node, and the crackling returns.

Ubuntu-24, 6.14.0-29-generic, external USB sound

Vit
  • 261