12

I recently did a fresh install of Ubuntu 19.04 and my speakers have been constantly making a static noise with crackling. I didn't have this issue in 18.10. The static sound goes away for a second when I change the volume and there is no sound when I completely mute the audio.

3 Answers 3

19

Asked and answered here.

The solution is to add this to /etc/modprobe.d/alsa-base.conf

options snd-hda-intel power_save=0 power_save_controller=N
5
  • sudo echo -e '\n# Disable snd-hda-intel power saving\noptions snd-hda-intel power_save=0 power_save_controller=N\n' >> /etc/modprobe.d/alsa-base.conf
    – Khalid Ali
    Apr 21, 2019 at 20:23
  • Worked for me, my computer is a ServalWS with Pop!_OS 19.04 Apr 26, 2019 at 6:19
  • Tested this on Ubuntu 18.04, Asus UX501VW-DS71t laptop, and I'm amazed it worked! Been suffering through that noise for so long! Sep 23, 2020 at 4:20
  • 3
    It came back for some reason :( Sep 25, 2020 at 4:08
  • Alienware 17R3 (HDA Intel, Creative CA0132 codec). This solution eliminated speakers crackling completely while many other ways did not help! Mar 5, 2021 at 19:28
2

You can create a systemd (system-daemon) service script that will run at boot.

Open a terminal and run:

sudo nano /etc/systemd/system/powersave.service

authenticate, then add the following to the file:

[Unit]
Description=powersave script

[Service]
ExecStart=/opt/powersave.sh

[Install]
WantedBy=multi-user.target

CTRL+O to save and CTRL+X to exit.

Then run...

sudo nano /opt/powersave.sh

...and add the following:

#!/bin/bash
echo 0 | sudo tee sys/module/snd_hda_intel/parameters/power_save

CTRL+O to save and CTRL+X to exit.

Finally, make the script executable:

sudo chmod+x /opt/powersave.sh

..then, enable the service by typing:

sudo systemctl enable powersave

This script will run on boot as the root user and should result in no more crackling, because it will keep your soundcard ON, instead of allowing it to go into powersaving mode.

This solution worked with my hardware. The output of lspci for my system is:

Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 02) 
1

I have same problem in 16.04 and 18.04. At present I am running 18.04.I have tried all suggestions from web like:

  • Kill Pulse Audio
  • Kill Pulse Audio and change /etc/pulse/default.pa
  • Try Following commands:

    hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x67
    hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x3000

  • Removing Speech Dispacher
  • Set nice level of pulseaudio to -20 and allowing real-time priority of pulseaudio
  • Try changing power-save options like

    echo 0 > /sys/module/snd_hda_intel/parameters/power_save
    echo N > /sys/module/snd_hda_intel/parameters/power_save_controller

Some of the above options worked for some folks and not worked for most. I tried to some basic level debugging, so started doing strace when audio/video is on. Then the crackling sound was stopped. Here is the sample command I tried:

sudo strace -f -p $(ps -eaf|grep -E "^$USER.*/bin/pulseaudio"|grep -v grep|awk '{print $2}') 2>&1|head -1000

I found 1000 lines of strace output is sufficient to restore the sound. Please keep in mind following:

  • We have strace the pulseaudio process of the user (not the gdm process). So that is the reason we are grep'ing for $USER variable
  • When you are issuing above strace command, audio/video stream should be running
  • most of the 1000 line of strace is sufficient. You may double those lines or rerun the same command
  • Keep in mind that, if audio/video is changed, then same cracking sound will reappear. Once again run same script, the cracking sound will go.
  • Also keep in mind that this also might not solve your issue(until it is confirmed by lot others with various other configurations)

Not the answer you're looking for? Browse other questions tagged or ask your own question.