Wednesday, May 20, 2009

» Fixing Pulseaudio stutters / pauses / glitches +

It seems that for many AC'97 sound chips, the new scheduler / timer in Pulseaudio >=0.9.11 causes hiccups in sound playback. These are exacerbated when the daemon is not running with higher priority and realtime permissions. The simple fix is to use the older scheduler. To do this, edit /etc/pulse/default.pa and add the tsched=0 option to module-hal-detect (or module-alsa-source if you manually load it). It should look something like this:

load-module module-hal-detect tsched=0

To enable high priority and realtime permissions on the daemon you need to be in the audio, pulse-access and pulse-rt groups:

sudo usermod -a -G audio,pulse-access,pulse-rt

Ps. You'll need to log out and log back in before you're actually in the groups.

Next you (may, depending on your distrbution) need to add the following entries to /etc/security/limits.conf

@pulse-rt       -       rtprio          99
@pulse-rt - nice -20

Then you need to add the following options to /etc/pulse/daemon.conf:

high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 8
no-cpu-limit = yes

Now restart pulseaudio:

pulseaudio -k ; pulseaudio -D

No more stuttering. :)

Labels: , , ,