Distorted audio over headphones in Ubuntu 17.04 dual booted with Windows 10

Solution 1:

I had the same issue. Give this a shot it ended up working for me

sudo apt-get remove --purge alsa-base pulseaudio
sudo apt-get install alsa-base pulseaudio
sudo alsa force-reload

Solution 2:

It turns out that there's a bug with HP audio driver which causes this problem. I could successfully fix it with following solution. Note that this solution is applicable only if your audio device is Realtek ALC295.

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

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