Audio dropouts / glitches / skips on Ubuntu 16.10

I recently upgraded the hardware of my home server and therefore decided to do a clean setup of the whole system, as the current one was heavily customized and I wanted it to be more clear. After installing the hardware and the newestest Ubuntu 16.10 (and lots of other programs and settings), I noticed some strange audio problems: I got random audio dropouts. After googling around a bit, I first thought about a problemen with alsa or pulseaudio and started to test some suggested configuration changes: Disable timer-based scheduling in pulseaudio, disable Intel IOMMU or some strange module parameters for snd-hda-intel [1].

I also tested around with alsa and pulseaudio: In VLC you can easily select the way, audio is sent to the speakers, but selecting direct alsa hardware output gave me the same strange behaviour than sending the audio over pulseaudio to alsa.

After some time I also remembered, that I had some similar problem with the old system and some movies. The problem here was some incompatibility between alsa and my TV concerning the sampling rate the audio was sent to the TV. The solution here was to make alsa and pulseaudio re-sample the audio to a specific rate:


pcm.dmixer {
  type dmix
  ipc_key 1024
  ipc_key_add_uid false
  ipc_perm 0660
  slave {
    pcm "hw:0,3"
    rate 48000
    channels 2
    period_size 1024 
    buffer_size 4096
pcm.!default {
  type plug
  slave.pcm "dmixer"


default-sample-rate = 48000

This also didn’t help in this case 🙁

I already knew, that my problem wasn’t with pulseaudio as sending audio directly to alsa gave me the same error, but nevertheless I tried to get some verbose log output from pulseaudio. First, I deactivated the auto-restart of pulseaudio and after that started pulseaudio with verbose logging in the foreground:

echo autospawn = no >> ~/.config/pulse/client.conf  # use ~/.pulse/client.conf on Ubuntu <= 12.10
pulseaudio -k
LANG=C pulseaudio -vvvv --log-time=1 2>&1 | tee pulseaudio.log

This gave me the real problem: Whenever the audio stopped for a moment, pulseaudio told me that the headphone jack has been plugged in. This caused pulseaudio/alsa to automatically redirect the audio to the headphone jack. After some time, pulseaudio/alsa noticed, that there isn’t actually a headphone plugged in and switched back to the HDMI audio output. This effectively gave me some short dropout in the audio.

( 123.195|  96.251) D: [pulseaudio] module-alsa-card.c: Jack 'Front Headphone Jack' is now plugged in
( 123.195|   0.000) D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status yes
( 123.215|   0.020) D: [pulseaudio] module-alsa-card.c: Jack 'Front Headphone Jack' is now unplugged
( 123.216|   0.000) D: [pulseaudio] device-port.c: Setting port analog-output-headphones to status no

This switching between the audio sinks was also visible in the pulseaudio volume control (pavucontrol) as the playback stream disappeared for a fraction of a second and immediately reappeared.

In my case, the solution for this problem was pretty straight forward: I only want audio to be given to my TV that is connected using HDMI. I don’t care about a headphone being plugged in. Therefore I simply told pulseaudio to ignore such events by commenting the following line in /etc/pulse/ :

load-module module-switch-on-port-available


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.