Ubuntu – Fix audio glitches with Intel HDA Realtek 887-VD

alsadrivershda-intelpulseaudiosound

I've just self-build a beefy new desktop, with a Gigabyte Z97P-D3 mobo, intel i7-4790K, 16GB RAM. I am using the on-board sound hardware intel HDA (Realtek ALC887-VD) for audio output. I'm running Ubuntu 14.04 LTS.

Every few minutes I can hear a short skip in audio playing, almost as though one frame is being dropped. It's incredibly annoying and happens regardless of the source (VLC / Spotify / Chromium browser). In the brief moment during a skip, the Sound Preferences > Output tab's list of devices gets greyed out, and the volume control indicator briefly flashes as though it is muted, before all flicking back to normal.

ALSAmixer also similarly glitches during the skips with the volume bars all disappearing for a fraction of a second.

I've tried the following workarounds (none of which work for me):

1) /etc/modprobe.d/alsa-base.conf: Position_fix setting

options snd-hda-intel model=generic position_fix=1

2) PulseAudio /etc/pulse/default.pa: Turning off tsched

load-module module-udev-detect use_ucm=0 tsched=0

3) PulseAudio /etc/pulse/default.pa: Adjusting defaults (all sorts of combinations and values of the below)

default-fragments = 2
default-fragment-size-msec = 250
default-sample-rate = 48000
realtime-scheduling = yes
realtime-priority = 5

4) Reinstalling PulseAudio

5) Upgrading the kernel to the latest stable (4.4.2)

6) Using Jack2 instead of PulseAudio

7) Buying a new sound card (SoundBlaster Live), which doesn't seem to work with various applications like Spotify.

Output of cat /proc/asound/card*/codec* | grep Codec:

Codec: Intel Generic

Codec: Realtek ALC887-VD

Codec: Nvidia GPU 60 HDMI/DP

Output of cat /proc/asound/card*

0 [HDMI ]: HDA-Intel – HDA Intel HDMI
HDA Intel HDMI at 0xf7914000 irq 33

1 [PCH ]: HDA-Intel – HDA Intel PCH
HDA Intel PCH at 0xf7910000 irq 32

2 [NVidia ]: HDA-Intel – HDA NVidia
HDA NVidia at 0xf7080000 irq 17

It's card #1 that I'm using.

Output of uname -a:

Linux alnitak 4.4.2-040402-generic #201602171633 SMP Wed Feb 17 21:35:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

I suspect this has something to do with the intel HDA drivers seeing as Pulse, ALSA and Jack are all affected.

Are there any fixes I'm missing?

Best Answer

The Linux device driver called snd-hda-intel has been apparently causing huge amounts of aggravation since at least November 2010 when one aggravated user wrote a PulseAudioMicrophoneGuide.pdf.

Here is what I have figured out so far: PulseAudio is a software layer that runs on top of Alsa. Alsa is a software layer that loads a large number of driver software packages. Alsa is not just drivers for the electronic signals. Alsa loads several different little pieces of software for each electrical signal, like a mixer and like the software that reads bytes from a microphone or writes bytes to a headphone amplifier.

My 2015 Lenovo S21e laptop has a "no sound from the built in microphone" problem and as a result neither Skype or GoogleHangouts Chat works with the built in microphone.

The short term fix for me is to plug in a Webcam with microphone or use a Plantonics USB headset.

Here is what I think needs to be done. I am not a C programmer (just Python, Perl and Arduino). Inside the device driver that is talking to the hardware find the location in the source code where the audio data is being copied from the microphone memory location. One of the output channels, Right or Left is being inverted somehow in the software. My guess is they did a signal inversion hoping to cancel out some kind of noise from the signal. So the trick is to figure out why the original programmer forced an inversion. If nothing else, remove the inversion and see if that makes the Right and Left Channels OK.

Related Question