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: , , ,

4 Comments:

Blogger Tommy said...

I have this exact problem with pulseaudio 0.9.21-63-gd3efa-dirty. I've tried both your solutions, and neither worked. The first one made pulseaudio refuse to start, saying:
E: module.c: Failed to open module "module-hal-detect": file not found
E: main.c: Module load failed.
E: main.c: Failed to initialize daemon.

When trying your second solution, there was no difference. I still had major skipping.

Any ideas?
May 28, 2010 at 6:27 AM

 
Anonymous Anonymous said...

thx, tsched=0 works for me :D
December 12, 2010 at 4:25 AM

 
Anonymous Anonymous said...

Nowadays, the line reads module-udev-detect instead of module-hal-detect and you need to modify /etc/pulse/default.pa when you run pulseaudio per-user sessions and /etc/pulse/system.pa when you run pulseaudio system-wide

Thanks for this great source of info.

Cheers,

AmmO
February 15, 2014 at 5:55 AM

 
Blogger Ether Rain said...

this works, did not need to do to much different than what was already listed here and in the comments to get it to work, it was really annoying to have skipping audio half the time, so thanks for this. ps: had to manually add the group pulse-rt on ubuntu 15.10 :)

July 2, 2016 at 4:13 AM

 

Post a Comment

<< Home