Stuttering audio in Linux: PulseAudio strikes again

I unmasked PulseAudio 10.0 back in January 2017 and installed it in my Gentoo Stable amd64 installation, and everything worked fine… until a couple of days ago, when the audio in streaming YouTube videos started to stutter every so often. It sounded rather like a scratched LP jumping. At first I thought the problem lay with Firefox, but the stuttering audio also occurred in Chrome. Then I wondered if my Internet connection was to blame; perhaps the ISP’s service had deteriorated. But a Windows 10 machine on my home network didn’t suffer from the problem, so that seemed to rule out the Internet connection. I tested the broadband throughput, and it was circa 32 Mbps, actually a little higher than the last time I tested it last year.

Now, Gentoo is a rolling distribution and I update my laptops regularly, but I couldn’t think what had been upgraded in the last couple of months that could be causing the problem. Although PulseAudio had not been upgraded since January, I began to wonder if PulseAudio could be involved, as my audio woes in the past have usually been due to PulseAudio.

I have always had PulseAudio installed with USE=”-realtime”:

user $ eix -I pulseaudio
[I] media-sound/pulseaudio
     Available versions:  10.0 {+X +alsa +alsa-plugin +asyncns bluetooth +caps dbus doc equalizer +gdbm +glib gnome gtk ipv6 jack libressl libsamplerate lirc native-headset neon ofono-headset +orc oss qt4 realtime selinux sox ssl system-wide systemd tcpd test +udev +webrtc-aec zeroconf ABI_MIPS="n32 n64 o32" ABI_PPC="32 64" ABI_S390="32 64" ABI_X86="32 64 x32"}
     Installed versions:  10.0(16:07:53 19/04/17)(X alsa alsa-plugin asyncns bluetooth caps dbus gdbm glib gnome gtk ipv6 jack orc qt4 ssl tcpd udev webrtc-aec zeroconf -doc -equalizer -libressl -libsamplerate -lirc -native-headset -neon -ofono-headset -oss -realtime -selinux -sox -system-wide -systemd -test ABI_MIPS="-n32 -n64 -o32" ABI_PPC="-32 -64" ABI_S390="-32 -64" ABI_X86="32 64 -x32")
     Description:         A networked sound server with an advanced plugin system

but I wondered if PulseAudio’s real-time scheduling was somehow the cause of the problem, so I edited /etc/pulse/ and added ‘realtime-scheduling = no‘ (I assume the default is ‘yes‘, as it was commented as such in the file):

; realtime-scheduling = yes
realtime-scheduling = no

Problem solved. PulseAudio is indeed a demon. 😡

About Fitzcarraldo
A Linux user with an interest in all things technical.

11 Responses to Stuttering audio in Linux: PulseAudio strikes again

  1. Thomas says:

    Thank you, this blogpost helped me a lot with playing YouTube videos on my laptop. 🙂 Maybe you should add info how to restart the demon (e.g. pulseaudio -k && sudo alsa force-reload) for n00bs like me.

  2. aturfer says:

    My Asus Z97 running KDE Neon has had choppy sound for a while now. Setting realtime-scheduling = no seems to have solved it for me! Thank you so much!!!

  3. Samir says:

    Thanks for this post. This solved the problem that I was having with my Bose QuietComfort 35 headphones. Just restarting the daemon didn’t work for me. I had to reboot the system. This was on Ubuntu 16.04.

  4. Darko says:

    Thanks It solved my problem too. Debian 9

  5. Stanley Joyce says:

    Thank you. This was very annoying. Turning realtime scheduling off solved my audio skipping issue as well. Linux Mint 18.3 (KDE edition)

  6. Pingback: A quest for bit-perfect audio in Linux – Chitpong's Note

  7. Jason says:

    I am having the same issue and I don’t know how to fix it

  8. hulloanson says:

    How did you figure it out? You’re a genius!

  9. Security says:

    Thanks! Worked like a charm

  10. daivd says:

    It worked for me on Linux Mint 19. Thanks!!!!

  11. mwrsa says:

    Same here. Some Videos on Mint 19.3 were simply impossible to watch, while others worked just fine. Anyway, this is the solution I was looking for. Ty so much!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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