88

After installing Ubuntu 20.04 on my desktop computer (Realtek onboard sound card, codec ALC887), I am experiencing a very annoying click (popping sound) every time I open any content with audio.

Rodrigo Viana Rocha
  • 2,431
  • 3
  • 18
  • 10

6 Answers6

112

It was happening because Ubuntu turned on the sound card power-saving capabilities. Turning it off can be the only way to get rid of the annoying sound:

  1. Verify how is your sound card's power_save parameter:

    cat /sys/module/snd_hda_intel/parameters/power_save
    
  2. If it returns 1, do the following to change it temporally:

    echo "0" | sudo tee /sys/module/snd_hda_intel/parameters/power_save
    
  3. If the previous step worked for you, persist that configuration (otherwise the problem will continue after reboot):

    echo "options snd_hda_intel power_save=0" | sudo tee -a /etc/modprobe.d/audio_disable_powersave.conf
    
  4. (Optional) You can also do the same for power_save_controller parameter following the steps 1, 2 and 3 replacing power_save by power_save_controller also changing 0 to N.

    Note: using the first step will probably return Y for this parameter, instead of 1.

David Foerster
  • 36,890
  • 56
  • 97
  • 151
Rodrigo Viana Rocha
  • 2,431
  • 3
  • 18
  • 10
53

For those here in 2022 that have just upgraded to Kernel version 5.13.0-37. (Use uname -a to check your kernel version.)

There appears to be a bug in this version causing audio crackling sounds for external audio interfaces but there is a workaround.

Change Pulse Audio's default sample rate to 48000.

sudo nano /etc/pulse/daemon.conf

Find the lines starting with

; default-sample-rate
; alternate-sample-rate

Remove the ; and change the values to 48000 so it looks like this:

default-sample-rate = 48000
alternate-sample-rate = 48000

Save the file, then restart pulse audio with pulseaudio -k

Baa
  • 3,750
36

You can suspend power saving via PulseAudio instead of via the sound card and comment out the following line in /etc/pulse/default.pa to look like this:

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle

Then restart PulseAudio:

systemctl restart --user pulseaudio

If that doesn't work then just kill it and it will restart:

pulseaudio --kill
Elijah Lynn
  • 3,928
6

For anyone using Pop!_OS with Ubuntu 22.04 or higher, the audio software is now pipewire, and no longer pulseaudio. So @user1115995's solution of disabling the suspend feature on pulseaudio, can be done for pipewire with these commands: (source)

sudo sed -i 's/--\["session.suspend-timeout-seconds"\] = 5/\["session.suspend-timeout-seconds"\] = 0/' /usr/share/wireplumber/main.lua.d/50-alsa-config.lua
systemctl restart --user pipewire.service
hananamar
  • 170
1

I've tried solutions above however they did not seem to help me. Or at least did not seem to help me alone. The extra step that I did was to enable auto mute in alsamixer.

Steps to do that:

  1. Type alsamixer to the terminal.

  2. Scroll all the way to the right by pressing RIGHT arrow key until you hit Auto-Mute Mode.

  3. Enable it by pressing UP arrow key then hit ESC.

Note that I have to do it again after restart. However I am sure there is a way how to preserve these alsamixer settings such that they survive rebooting.

0

After having tried literally every proposed solution, I ended up adding pavucontrol to my startup items. That works very reliable, even now with pipewire being the "chef". Only drawback is that I still get short hums, during bootup.

I'm on 24.04, and the problem occurs when connecting my M-AUDIO active monitors. No difference if on battery or connected to a power source.

benzkji
  • 193