Cracking and popping sound from left side of headphone on Front Left/Right sound test

I have exactly the same problem as
1. Crackling sound when using headphones - 16.04
However this question is marked as duplicate of
2. Distorted and Choppy Audio

I have exactly the problem.

And the comments on the following links shows that the problem is common for audio chip Realtek ALC295
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1648183 https://bugzilla.kernel.org/show_bug.cgi?id=195457

and it seems that it is a problem in kernel.

The result of cat /proc/asound/card0/codec* | grep Codec is

Codec: Realtek ALC295
Codec: Intel Kabylake HDMI

and as you can see that it uses the same sound chip as appeared on the first link. My laptop is also brand new like it appeared on the first link. I suspect that it is a software problem, not a hardware problem.

I tried both of the solutions in the second link (which is from 4 years ago!) but none worked.

relevant output from lspci -v is

00:1f.3 Audio device: Intel Corporation Device 9d71 (rev 21)
    Subsystem: Hewlett-Packard Company Device 81a9
    Flags: bus master, fast devsel, latency 32, IRQ 292
    Memory at b1228000 (64-bit, non-prefetchable) [size=16K]
    Memory at b1210000 (64-bit, non-prefetchable) [size=64K]
    Capabilities: [50] Power Management version 3
    Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel, snd_soc_skl

and kernel information

Linux computername 4.10.0-20-generic #22~16.04.1-Ubuntu SMP Thu Apr 20 17:43:29 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I think this problem is NOT a duplicate of the second link (although it technically is a duplicate of the first link).


::SOLVED:: 19/05/2017

I'm sorry for a very sloppy answer, but the post by Robert Joynt in

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1648183

Solves it.

All the credits to Mr. Robert Joynt. With all the respect to him, if anyone has a suggestion for a better way to make his solution public, please suggest me.

Robert Joynt (robertjjoynt) wrote on 2017-05-17: #17 I've managed to fix this problem on my machine (HP Omen 15 running Ubuntu 17.04 using codec for Realtek ALC295 sound device). To fix the problem, I can do the following:

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


I've had the same problem with my HP Pavilion i7-7500U running Xubuntu 16.04.2 LTS on 4.8.15-040815-generic kernel. It has the same sound device as you, Realtek ALC295.

This is clearly demonstrated by muting the left output channel while playing something - there appears to be a distinct crackling noise leaking through from the right channel to the left, despite being muted.

Looking through several forums, one of the recommendations provided was to boot into Windows 10 with headphones not plugged in, restart from the login screen and boot into [X]ubuntu - then plug in your headphones once you've logged in.

Since doing this I've had no problems - but I appear to have to do this for every restart.

While this isn't a permanent fix, out of courtesy I thought I would share my findings.