Periodic clicking sound from PC speaker
It seems that the problem resides within the Intel High Definition Audio drivers, and it has been around for quite some time now.
To solve the problem temporarily, but immediately, issue the following command:
echo 0 | sudo tee /sys/module/snd_hda_intel/parameters/power_save
Try the previous command to be sure you are suffering this problem. If this works for you, then you can solve it permanently by adding the following line above "exit 0" in "/etc/rc.local".
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
Hope this helps
Sources: post 1 post 2
taken from these threads:
how to execute a command after resume from suspend?
http://ubuntuforums.org/showthread.php?t=2019203
https://stackoverflow.com/questions/11183805/run-bash-script-from-another-script-without-waiting-for-script-to-finish-executi
create a script named hda-fix
and place it in /etc/pm
or somewhere in your home dir if you prefer. It should contain:
#!/bin/sh
sleep 5
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
exit 0
in folder /etc/pm/sleep.d
create a script named say 30_hda-fix containing
#!/bin/sh
case $1 in
resume|thaw)
exec /etc/pm/hda-fix &
;;
esac
similarly, for when you unplug the power, drop a similar script in /etc/pm/power.d
#!/bin/sh
case $1 in
true)
exec /etc/pm/hda-fix &
;;
esac
for some reason the script is not executing well if you do it instantaneously; the crackling is activated after the scripts are running; therefore, u need a second script that is run and waits for the cracking to start before it executes. the &
in the exec line in the scripts avoids the master script from blocking; this is the only way I found to accomplish the execution of the command after the cracking has started. I looked at the at command but it only handles minutes so this was my workaround
Relates to: Ubuntu 16.04
For me the opposite was working. Put following into: /etc/modprobe.d/alsa-base.conf
options snd-hda-intel power_save=1 power_save_controller=Y
/sys/module/snd_hda_intel/parameters/power_save was already 0, however every time playing a sound the ticking is back for a short while but will be deactivated then by the power manager.