11

I've just installed Ubuntu 16.10 on a Lenovo Yoga 910 and am finding that the audio crackles from time to time when listening through headphones. It occurs predominantly on the left channel and seems to be associated with lower frequencies, as if I use an equaliser to turn all sliders below 1kHz all the way down, the crackle disappears. It seems to be deterministic, occurring consistently on specific recordings in specific locations.

It doesn't seem to be associated with pulseaudio, as I tried disabling it, but the crackle remains. I've also tried using the 4.10 mainline kernel.

I've tried all permutations of the following snd-hda-intel options in /etc/modprobe.d/alsa-base.conf: model=auto, power_save=0, power_save_controller=N and all the possible values of position_fix.

I've also tried disabling auto mute in alsamixer but did not help.

I found this recent ALSA bug report which looks like it could be what I'm experiencing. I thought I would ask here to see if anyone had any ideas for anything else I could try to fix the problem.

nedned
  • 401
  • Thanks for the suggestion! I tried playing around with hdajackretask, but mostly this didn't help. I say mostly, because after a session of fiddling around and then restoring the changed values, on rebooting, the crackle was completely gone. The next reboot it had returned. So it's not clear if this was related to anything I did with hdajackretask, nor how this would be made persistent if it did. Perhaps I'll have another play around again soon. – nedned Jan 05 '17 at 02:18
  • I have the same hardware, and having the same problem on 16.04 (also tried more recent kernels). Have tried all solutions I've come across, but not success. – myanimal Jan 13 '17 at 10:32
  • Why Debian maintainers are not issuing a patch? – Brian Cannard Oct 28 '18 at 20:51

4 Answers4

5

A solution to this problem was found by Robert Joynt in a comment to this alsa-driver bug report. Here is a copy of the instructions:

Install alsa-tools if not installed:

sudo apt install alsa-tools

Create and save a script in /usr/local/bin:

#!/bin/bash 
hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX 0x67 
hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF 0x3000

Run the script as root in a terminal to immediately fix the problem.

To run the script on startup, use cron with the @reboot command:

sudo crontab -e

and then add line in crontab:

@reboot [full path to script]

To run script on resume from suspend, copy the script to /lib/systemd/system-sleep

For more technical details regarding this fix, see https://bugzilla.kernel.org/show_bug.cgi?id=195457

nedned
  • 401
  • This solved my problem, thanks for that. But I wondered that, at first this problem didn't existed, then why did it occur suddenly. The problem with my PC was that, the sound from the left ear plug of my headphone crackle whenever I suspended it. – Deepam Gupta Dec 21 '19 at 11:51
2

This issue is still present for me in Ubuntu 20.04.1, on a a HP Pavilion 15-cw1905nz, and there is good indication that it is not a Ubuntu specific bug.

robertjjoynt's fix worked for me, but only after I changed the sound card from hwC0D0 to hwC1D0. So my script goes:

#!/bin/bash 
hda-verb /dev/snd/hwC1D0 0x20 SET_COEF_INDEX 0x67 
hda-verb /dev/snd/hwC1D0 0x20 SET_PROC_COEF 0x3000

You may have to tweak it a bit: if the above script doesn't work, try to replace "hwC1D0" with some other device (listed in /dev/snd/) until it works.

If it still doesn't work, then maybe the particular coeffs you need to change are not the same. There's an answer by Frédéric Pierret on bugzilla detailing how all of this works. My ears are eternally grateful to both him and Robert.

Sara R.
  • 21
0

TL;DR: plug-in , suspend, resume => fixed

How I fixed mine Ubuntu crackling headphones:

  1. I made sure I don't have over-volume (like 150% of max volume etc...)
  2. I made sure headphones are plugged-in correctly
  3. I sent the laptop to sleep - "Suspend"
  4. ...waited till it went sleepy...
  5. Resumed from suspend / awaken the laptop / turned it back on
  6. Logged-in/Unlocked
  7. No crackling :)

So you may not actually need any script, however, if this is happening to you a lot and you want to somehow prevent it or know what is the technical background - refer to the @nedned's answer.

If the problem after any solutions presists, first, make sure your headphones are NOT crackling when used with devices you use them with normally - like your phone that you use the headphones for etc... if they are crackling everywhere - it is probably the headphones issue - there may be a water inside them - let them dry - or may be damaged completely (after a lot of over-volume).

jave.web
  • 420
0

Just posting a solution working for me.

It was something as simple as adding your user to the pulse-access:

sudo adduser [your-user] pulse-access

Hope it works!

BTW, do not forget to have fun!

P.S.- It is only a workaround, because if you dive into sound settings and you touch the volume settings of your web-browser streaming it will fail. In my case, so it is a solution for me, because I don't use to dive there...:D...I'm only a music consumer...;P