Over-optimistic buffering in PulseAudio causes underruns (audible stuttering, pops)

Bug #190754 reported by kripken on 2008-02-10
210
This bug affects 8 people
Affects Status Importance Assigned to Milestone
gst-plugins-good
Fix Released
Medium
paconfig
Invalid
Undecided
Unassigned
linux (Ubuntu)
Undecided
Unassigned
Declined for Hardy by Daniel T Chen
pulseaudio (Mandriva)
Fix Released
Medium
pulseaudio (Ubuntu)
Low
Unassigned
Declined for Hardy by Daniel T Chen

Bug Description

Responsiveness of the desktop in Hardy, under CPU load, is significantly poorer than in previous versions of Ubuntu, on the same hardware.

The easiest way to see it for me is to do this:

1. Downclock my Athlon64 3000 to 1Ghz from 2; this makes things more noticeable. I also suspect that people running fast machines is why this isn't reported more. Perhaps especially on multicore machines it won't be significant.
2. Record a long-enough piece in Sound Recorder (doesn't matter what, so long as you would notice if it didn't play smoothly).
3. Press play, and do Alt-Tab between the Sound Recorder window and e.g. Firefox, Nautilus, Totem, etc.

The symptom is that sound 'stutters' along with what sounds like static interference. If the sound recording is music, then it becomes impossible to listen to in a pleasant manner.

Similar and worse symptoms occur when doing so under CPU load, say when compiling a big app, applying updates, etc.

This is not a hardware issue, since the same computer was very responsive under Gutsy (and older versions), even at 1GHz. However, I state my specs here just for comparison: Athlon64 3000, 512MB RAM, AC'97 onboard sound,

00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)

and using the NVidia binary driver for video.

My (unfounded, hence I didn't specify a package for this bug) suspicions are that perhaps the issue is to do with the new CPU scheduler (CFS) and/or the new sound backend (Pulseaudio). I suspect them only because they are new, I have no specific evidence against either at this point.

Murat Gunes (mgunes) wrote :

Thanks for reporting. Do these interruptions/stutters only occur with audio, or do other apps stutter as well when there are no audio operations but the system is under heavy load?

kripken (kripkenstein) wrote :

This occurs with other things than audio, but is much harder to notice. For example, when playing a movie in Totem during heavy CPU load (compiling something in another window), I see both audio and video stuttering. But the video is much harder to notice, you need to look carefully to see that it isn't smooth. Whereas the audio stuttering and 'static' can't be ignored.

Gaspard Leon (gaspard.leon) wrote :

Confirming using:
Athlon XP 2500+ 1.83Ghz
ABit NF7-S Mobo w/ NForce 2 chipset
2GB RAM
NVidia 5900XT w 128MB with 169.09 from the restricted package
SCSI, SATA, and IDE harddrives

- Open Rhythmbox
- Choose Import folder from the menu
- Choose my music folder, which was about 4000 files, 20GB..
- CPU pegs at 100%, so should be a good test.
- while it's importing to the library, try to play a movie file...
strangely, the sound of the movie is solid, but the video is stuttery for me

While typing in this firefox window to confirm the bug (library still importing), there is significant lag while typing the text...
If you hold down a key like left or right to scroll through the text it's jumpy.

will have to reboot into Gutsy to confirm it's hardy-only...

Cheers,
Gaspard

Gaspard Leon (gaspard.leon) wrote :

confirming, I just rebooted to gutsy, (with hardy kernel 2.6.24-7)

dumped my media library in ryhthmbox to confirm using the same procedure.

with CPU pegged at 100% the system is smooth and responsive, video and audio play smooth without hitching...

typing the text into this box is normal.

Maybe it has something to do with the new GVFS?? seeing as I'm using the same kernel on Gutsy and Hardy, the big difference is that GNOME and the apps are newer

Cheers,
Gaspard

Wade Menard (wade-ezri) wrote :

It sounds like you are experiencing the symptoms of bug 131094

kripken (kripkenstein) wrote :

> It sounds like you are experiencing the symptoms of bug 131094

No, I believe that is an unrelated manner. I experience this bug even without any disk IO, as shown in my example above, of alt-tabbing between Sound Recorder and Firefox. There is little if any disk IO in such a case as far as I can tell.

Also the older bug is relevant to various Ubuntu releases, and this new bug appears to happen *only* in Hardy, i.e., it is very new.

Kim Krecht (kim.krecht) wrote :

I am confirming the occurence of this problem with current hardy on a IBM ThinkPad T30, 2366-97x. It only shows when using PulseAudio as output as opposed to ALSA. I am deviating from the default PulseAudio configuration only in this way:

--- /tmp/default.pa 2008-02-25 21:41:01.000000000 +0100
+++ /etc/pulse/default.pa 2008-02-25 17:34:25.000000000 +0100
@@ -37,0 +38,4 @@
+#### Kim~* {
+load-module module-alsa-sink device=default
+load-module module-alsa-source device=default
+#### }
@@ -41 +45,2 @@
-load-module module-hal-detect
+#### Kim~*
+#load-module module-hal-detect
@@ -45 +50,2 @@
-load-module module-detect
+#### Kim~*
+#load-module module-detect

This is just to make Skype work with the "raw" ALSA device instead of PulseAudio's emulation; Skype would not work otherwise.

I believe that overly optimistic buffering on PulseAudio's side is to blame here. The buffer is extremely small (on the order of a few dozen milliseconds or so) and thus underruns whenever failed to be fed continuously. Alt-Tab hogs resources for a long enough time to make this happen even without any IOWAIT or significant load. Seeing that my machine neither supports APIC properly nor has a second core, it is plausible that interrupts can unfairly steal CPU time even with a current kernel and its Completely Fair Scheduler. (With just the XT-PIC, any PCI interrupt will cause the system to ask every device on the PCI bus whether it caused the interrupt; also, with just one core, interrupts cannot be handled elsewhere, which might enable PulseAudio to run smoothly.)

Another source of disruption besides Alt-Tab is apt-get update. It will stutter about once for every package list file processed. Who knows, even fork() and/or the associated switches between kernelspace and userspace might be the culprit.

I have not had a look at the PulseAudio source since I would not know where to start.

PulseAudio seems to adapt its behaviour once a sufficient number of Alt-Tabs has been performed. Stuttering does not occur then anymore. It seems that more data is then buffered than under normal conditions. This looks akin to something like TCP slow-start in reverse ;)

Also, having sufficiently advanced hardware (my machine is in its sixth year) would obviously hide all of this.

The correct fix, IMHO, would be to make tweaks to the thresholds, constants, coefficients involved in the buffer size calculation, making it more conservative than it is now. However, I do not know how many buffers exist and where they are. There could be a per-sink buffer, a buffer for the netlink, a buffer in the core. Again, I would not know where to look.

It might also help to use a kernel patched for LatencyTOP and LatencyTOP itself to see whether any kind of priority inversion occurs.

Sorry for being unable to provide patches.

Murat: Simply being under load does not significantly impact responsiveness for me. Load averages of about 10 while playing back MPEG-4 Part 2 ASP video (such as Xvid encoded files) are free of problems - no frames dropped at all.

rubinstein (rubinstein) wrote :

I also have stutter when listening to audio under Hardy Heron.

I always set my Windows Preferences to "Select windows when the mouse moves over them". So now I only have to move my mouse to different applications, and sound begins to stutter. As pulseaudio has different settings for each application, maybe this could be a thing to consider, maybe something is broken here.

If I move the mouse very quickly over different windows, Xorg will have a high load (with and without the proprietary nvidia driver.).

rubinstein (rubinstein) wrote :

Also, it appears that the music will play ca. 20% slower when it stutters, and after some time it is normal again. I can make a sound recording and attach it to this bug, it it helps.

TerryG (tgalati4) wrote :

Marking as Confirmed, since enough people seem to notice this problem. I haven't seen any reference to an interaction between tickless kernel and pulse audio. Does the real time (rt) kernel suffer the same problem?

Changed in pulseaudio:
status: Incomplete → Confirmed
Colin Ian King (colin-king) wrote :

It may be worth seeing where the latencies are occurring using LatencyTop: http://www.latencytop.org

Christian Lachner (gladiac) wrote :

I also experience this problem on a Thinkpad T61 which is a dualcore machine with 4GB of RAM meaning you can even face this problem on decent hardware. I mostly notice this "stutter"-behaviour when hearing mp3s using audacious with the pulseaudio soundserver. It also happens even on low cpu-load. Using ALSA directly works fine for me.

psernetz (patrick-sernetz-com) wrote :

Do you guys updated to hardy with apt-get dist-upgrade or the update manager or did you a clean install from cd. I've experienced this problem with my update-manager updated version of hardy. Hearing mp3 with rhythmbox and minimizing windows caused a stuttering sound. Now I've did a complete reinstall from the alpha 6 cd and now everything is running smooth again.

rubinstein (rubinstein) wrote :

I did a fresh install with alpha 6 - sound is better, but nonetheless a bit stuttering when changing/minimizing windows.

kripken (kripkenstein) wrote :

I experience this bug (both sound and video) on a fresh install of Hardy (from around 2 months ago).

Gaspard Leon (gaspard.leon) wrote :

I installed on a separate partition, from Alpha 3, upgraded to the date I posted the message above (Feb 19th)

I have yet to redo the tests with the latest round of updates, but my hardy was not an upgrade from gutsy, my gutsy install is still gutsy

It would be good if someone else could do a complete reinstall of alpha6
and check if the problems then still exists. My lag problems are all
gone.

CPU AMD k6/2 2000
512 MB ram
Gefroce 6200 graphicscard

After a re-install of Hardy Alpha-6 so as to get today's revised kernel 2.6.24-12-generic on my E2160 rig, I installed Exaile, Kaffeine and VLC Player, plus the usual Gstreamer plugins etc, all as per Gutsy.
Although Hardy appears to be slightly faster than Gutsy, I find that running more than one audio-visual package results in audio conflict or even crashing of Kaffeine, if already running.

On the same rig, Gutsy allows me to set FreeView Kaffeine running, with audio carried across to a desktop on which I can run other packages, like Firefox etc, but Hardy doesn't like such multi-tasking.

Bruce R (bm007a0030) wrote :

Further Information - My E2160 rig uses Envy Legacy 6 for Gutsy, EnvyNG9 for Hardy-Alpha5

Arthur Cruz (s3t-sk8) wrote :

Fresh install of Alpha 6, then updated.
Well, sound lags.. and it's pretty annoying since it lags every "libnotify notification" from my IM client.

Have anybody tried another distro with pulse audio and 2.6.24 kernel?

I think that you will find that in using kernel 2.6.24 to make Ubuntu
easier to install, on a wider range of hardware than Gutsy which
used kernel 2.6.22, the team are at 'the cutting edge' of kernel use.
At kernel.org there are signs of work on kernel 2.6.25, but I know
of no distro actually using it yet.
Fingers crossed, the definitive Hardy kernel will further the great
work started by Gutsy and its sibling Daryna (Mint4).

Probably of no use to anybody, but this happens to me when playing in Quod Libet and alt-tabbing, etc.

I'm have an Athlon64 3000+ (1.8GHz), 1GB of RAM and an Nvidia 6800 GS (512MB).

While I don't know what graphics cards the laptops mentioned here have, it seems to me that everyone that has listed a graphics card seems to have an Nvidia card? Could this somehow be a problem with Nvidia's proprietary graphics drivers? (which of course would make it very difficult for Ubuntu to fix)

Arthur Cruz (s3t-sk8) wrote :

Wow, I have just updated Hardy, which updated Alsa as well!
I'm not experiencing this lags anymore! Alt+Tabs are okay, notifications don't lag anymore.. it's great!

After several tests here I conclude that this problem is gone in my AMD Athlon 2200+, VIA mother board, Nvidia video card and Sis sound.

Arthur Cruz (s3t-sk8) wrote :

oh.. premature conclusion!

It's not solved, but less noticeable.
The lags are still here. Not so frequently.

Regarding 'Shane' comment, the preponderance of NVidia cards is
probably because even Alberto Milone's Envy hasn't yet made new
ATI cards work properly, whilst Envy also confers a great desktop
versus overlay control panel to NVidia clones, complete with a GPU
temperature monitor !

I also just noticed that this bug doesn't seem to affect sound playing in Flash (for example, playing a song from a YouTube video or something). Is this significant or is this to be expected?

Shane: It certainly is, but probably makes sense to know which flash plugin you use. I know for certain gnash goes through pulseaudio if it's available - and if not probably just alsa. Don't know about the adobe flash plugin.

What is not clear to me still from this bug is whether this issue is a sound specific problem (lag and so on) - and then this is either pulse or alsa problem. Or whether this is a general responsiveness and multi tasking problem - and then most chances the kernel is to blame... (or some new configuration policy)
I personally suffer mostly from general unresponsiveness and slowness - sometimes the sound indeed halts when I just switch to another window (alt-tab, or just click-to-focus). And sometimes it's much more annoying - for example during a system update, refresh package list or install of packages the whole system is hardly responsive, slows down any interactive app, like firefox or a terminal and so on. This issue is very annoying - and certainly not related to sound.
So in the end is this bug about this problem, and just uses sound as a manifestation of it? or is it just a sound specific bug?

Shane (duairc) wrote :

I'm using the Adobe plugin... I don't know what it uses, but there's something in the back of my head telling me it's ALSA. Personally I haven't noticed any significant problems with multitasking so far with Hardy, though I've only been using it for a few days. Sound is definitely the biggest manifestation of this problem for me, if it is a general problem.

ubunturox (ubunturox-kk) wrote :

I had problems till yesterday - very disturbing lag, crackling etc. Today it seems to have disappeared. hardy x86 latest updates on Asus Z92 M laptop Turion dual core.

ubunturox (ubunturox-kk) wrote :

I spoke too soon. The disturbance comes back once I change volume level. I have to restart the player to get rid of the disturbance.

-JojoMan- (jojoman02) wrote :

i experience the same problem, i think it's a pulseaudio thing, this is really bad for laptops b/c they have less cpu power than desktops and most of my friends own only laptops.

-JojoMan- (jojoman02) wrote :

When i set the mixer & ALL sound playback to ALSA the problem *completely* goes away, so is DEF a pulseaudio problem.

Other users please Confirm that this fixes the issue.

Christian Lachner (gladiac) wrote :

Yes, I can confirm what JojoMan says. First, I thought it could be an internal buffering problem in the pulseaudio-server itselfs but that would not explain why the whole machine gets stuttering... I think the sound stuttering is just a side-effect and the real problem lies somewhere else... in connection with PA...

Arthur Cruz (s3t-sk8) wrote :

I can confirm what JojoMan says too. I've been using only ALSA and there are no lagging issues anymore.

I don't think this to do with hardy only , i experienced this problem with my brand new desktop before 3 months back when i tried to install Ubuntu gutsy 7.10 on it , the spec where : intel(R) Core(TM)2 Duo CPU E4500 @ 2.20GHz - 2 GB of memory , i tried the alternate installation also and get the same problem , finally i managed to get rid of it by installing Ubuntu Studio 7.10 which has a different kernel ( 2.6.22-14-rt ) the problem gone and every thing was fine , yesterday i installed hardy heron beta and I'm now having the same stutter in sound even if I'm not moving the mouse cursor or opening any application , tried to stop using compiz and close many applications but still the same.
I tried to change all devices to alsa , but still getting the same stutter
Another thing i noticed but not sure if its related to this bug , when i was using Ubuntu studio 7.10 i was not able to do a memory test from
grub screen i was getting this error : Error 28 : selected item cannot fit into memory
and now i cant do it also.
I feel that something is wrong with the kernel itself. ( just my feeling )

Gutsy had Jitter with O1 and ALSA when there was heavy load, like crypto disk R/W.
That problem is gone with Hardy - CFS really manages to keep sound stable in such sitations.

The interesting thing is that it only happens when minimizing/raising windows (especially from the notification area, no matter using Metacity or Compiz) - not when, say, looping the cover-flow task switcher plugin of Compiz.

I did a new hardy installation using the alternate CD beta , then set all the sounds setting to ALSA , the result is no stutter when I'm idle or minimize or maximize window , the stutter appear when starting any application for example it happend when trying to start Open Office Word processor or opening System Monitor window , it happens when opening them for the first time in an ubuntu session but closing and reopening again can't feel any stutter.

I have the same problem, but it does no occur when streaming to a remote PulseAudio sink over the network (the receiving machine is running Gutsy).
Also, I have so far only experienced the problem in MPlayer, not VLC nor Firefox.
I can get MPlayer to work with OSS (and pasuspender) without stutter.

Can we conclude this is a problem somewhere between the pulseaudio daemon and alsa?

Changed in pulseaudio:
importance: Undecided → Medium
J0Sb31R (josbeir) wrote :

Also having this problem...
example: playing music in rhythmbox when the song starts... doing a few window switches/alt-tabs etc... after a while the stuttering goes away...
It's really irritating because it happens every time.. also with movies etc...

Only way to resolve this is to set playback to ALSA in sound config. But i don't want to do that.
--
Gefore 8600GT
Amd64 3500+
Nforce4 motherboard => Nvidia CK804/Realtek ALC850 rev0
--

After deleting configuration files and reinstalling PulseAudio, it somehow fixed itself.
I no longer have problems with stuttering, but am continuing to experience a very long audio delay in VLC (bug 3735).

...sorry, I mean Ubuntu question 3735.

Martin (martin615) wrote :

I also experience this. Scrolling in windows, switching windows, etc. Almost everything that takes a little bit of CPU causes audio distortion.

+1, I have the same problem... On gutsy, movies were played smoothly even under high load. Now with hardy, choppy sound is heard whenever I do something a bit CPU consuming.

Nick Evans (me-nicolasevans) wrote :

I can also confirm what JojoMan says. I get a slight stutter when Alt Tabbing sometimes (I use the Compiz Ring-Switcher) but I get much more stutter when i click on other windows in the task bar or while raising focus by mouse.

I have a AMD 3200+, 2 gigs of ram. NForce4 mobo using the onboard sound card. (nvidia ck804 + realtek alc850, afaik.)

After many installations and tests on my new desktop, I found that :
1- Ubuntu Gutsy 7.10 and Ubuntu Hardy Heron 8.04 with there generic kernels are not do not work well with my desktop , both of them are just making the same stuttering on sound and even in video.
2- Ubuntu Studio Gutsy and Hardy are working well my computer after installing them i didn't felt any stuttering on sound or video , but my probles is that i want to use the normal Ubuntu not ubuntu studio or other distros .
Can any one do the same test by installing the ubuntu studio 8.04 and post the result here .
The difference between them is the kernel , in ubuntu studio the kernel is ( 2.6.22-14-rt ) it end with "rt" , the normal one end with " generic" , I'm just a regular user , so I'll appreciate if some one can explain to me why I get the sound stuttering when using the "generic" kernel and not getting it when using the "rt" kernel ??????
Sorry for my English

Keenan Pepper (keenanpepper) wrote :

Najmudin, better audio performance with the RT kernel is exactly as expected. That's what it is designed for. So if that solves your problem, then great. Also, you don't have to use Ubuntu Studio to use the RT kernel. You can install the RT kernel in normal Ubuntu (just install the package "linux-image-rt", from the Universe repository).

Max Randor (max-randor) wrote :

Following from Helge's comment I did :

sudo apt-get purge pulseaudio && sudo apt-get install pulseaudio ubuntu-desktop

(ubuntu-desktop meta package depends on pulse audio so needs to be reinstalled after purging pulse audio) doing this completely removes pulse audio and its configuration files and then installs it again. This appears to fix the problem with stuttering audio. Unfortunately I forgot to test after the first reboot after doing this and so it could have been one of the updates we have had since. Could someone else who is having this problem please try and see if this really is a solution?

Jörn Dreyer (j.dreyer) wrote :

Same Problem here. I just tried the purge && reinstall trick, but it did not work.

Jörn Dreyer (j.dreyer) wrote :

I remebered my laptop having problems with IRQs looking into dmesg I found th usual "nobody cared" message:

[ 49.434084] irq 17: nobody cared (try booting with the "irqpoll" option)
[ 49.434093] Pid: 3079, comm: modprobe Not tainted 2.6.24-14-generic #1
[ 49.434100] [<c0165924>] __report_bad_irq+0x24/0x80
[ 49.434113] [<c0165bfb>] note_interrupt+0x27b/0x2c0
[ 49.434120] [<c0164e20>] handle_IRQ_event+0x30/0x60
[ 49.434126] [<c01665b6>] handle_fasteoi_irq+0x86/0xe0
[ 49.434132] [<c0107f1b>] do_IRQ+0x3b/0x70
[ 49.434138] [<c0107f20>] do_IRQ+0x40/0x70
[ 49.434144] [<c0106413>] common_interrupt+0x23/0x30
[ 49.434153] [<c02100d8>] blk_trace_ioctl+0xd8/0xf0
[ 49.434158] [<c02167d8>] strcmp+0x28/0x30
[ 49.434165] [<c0150a91>] lookup_symbol+0x21/0x40
[ 49.434173] [<c0150b21>] __find_symbol+0x71/0x350
[ 49.434178] [<c0150ea4>] check_version+0x44/0xd0
[ 49.434185] [<c0152338>] sys_init_module+0xda8/0x19c0
[ 49.434209] [<c0140190>] param_get_int+0x0/0x20
[ 49.434217] [<c0132dd1>] irq_exit+0x51/0x80
[ 49.434228] [<c01053c2>] sysenter_past_esp+0x6b/0xa9
[ 49.434240] =======================
[ 49.434241] handlers:
[ 49.434243] [<f8ad4820>] (snd_atiixp_interrupt+0x0/0xf0 [snd_atiixp_modem])
[ 49.434255] [<f8af5d00>] (snd_atiixp_interrupt+0x0/0x130 [snd_atiixp])
[ 49.434264] Disabling IRQ #17

I dislike polling but tried the irqpoll option and now sound works flawlessly. Even under high load (single core). No stuttering so far.

Shane (duairc) wrote :

Perhaps I'm just lucky today, but this problem doesn't seem to be affecting me anymore.

kripken (kripkenstein) wrote :

This bug still exists for me.

I am on a completely updated system (as of 5 minutes ago), and I also did

sudo apt-get purge pulseaudio && sudo apt-get install pulseaudio

as recommended above. This has led to no improvement.

Note: It does appear that the bug sometimes 'vanishes' for periods of time. E.g. right after booting up, I might be able to alt-tab between a few apps before sound crackling occurs. Once the crackling occurs, it generally will continue to persist for all further alt-tabs (at least between apps that need to redraw themselves in a non-trivial way, which includes Firefox, Nautilus, gedit, etc., assuming open documents in all of them).

ionhand (davidgholami) wrote :

If you are using Rhythmbox change ur gstreamer mp3 plugin to use ALSA instead of pulseaudio (via gstreamer-properties). That fixed it my music from 'lagging' while doing CPU tasks.

I do experience this bug even using _Alsa_ as output. It is less noticeable, but it still occurs, especially on my not-so-recent computer (1.2 GHz Athlon, 1.25 GB Ram), which anyway is good at playing any media under Gutsy.
So I suppose this is not a pulseaudio bug: pulseaudio is just using more CPU, and that's why the bug is more noticeable.

Keenan Pepper (keenanpepper) wrote :

"pulseaudio is just using more CPU"

That's not it at all. If you actually look at the CPU usage, pulseaudio is using some tiny fraction (on my system usually less than 1%). The problem is that pulseaudio is using a very short buffer, so if it doesn't get to run exactly when it needs to, the correct audio data is not available and you hear a pop. The problem is latency, not throughput.

Max Randor (max-randor) wrote :

I was wrong

sudo apt-get purge pulseaudio && sudo apt-get install pulseaudio ubuntu-desktop

Has not actually worked, the situation has improved - I did lots of alt tabbing with cpu hungry programs running and it was fine. The problem appears to not be high CPU usage (at least on my machine) instead when there are large changes in RAM usage there is a brief pause.

At least I don't have the crackling and distortion I got towards the end on Gusty :-)

ionhand (davidgholami) wrote :

My comment above is not true, I still notice it lag... errrrr

Kristopher Ives (nullmind) wrote :

This bug is so bad that I decided to remove all traces of PulseAudio from my system using synaptic. (Ctrl+F for pulseaudio and 'Compltely removed' all packages that had few dependencies) and rebooted, in which it started using ALSA and I can now listen to music while I code or browse.

Sorry PulseAudio, maybe next release.

Even installing the RT kernel does not help here.

Bruce R (bm007a0030) wrote :

Hi Guys, I hope this helps some of you.
Noting that pulse audio is new, I tried Adding its controls, to find that it made my Hardy-Beta sound problems worse, with conflicts even leading to crashes or complete Hardy lockup, so, noting more recent comments, I Removed those controls.
(Please note that for media player compatibility, I routinely Add the six main GStreamer codecs plus libdvcss2.)

Since then I have done two completely fresh installs from the new menu install, using the Manual method to delete prior installation and to obtain 15GiB of free space (plus 1GiB logical drive swap) for the re-installation on two different dual-boot machines, one E2160 based (overclocked to a conservative 2.7GHz) and the other a trusty old 3.0Ghz Northwood based machine.
Installations were on 04 and 05 April with approx 290 Updates including the new 2.6.24-15-generic kernel.

I then Added my usual suite of about 120 packages including Kaffeine, VLC Player and Exaile to find that Exaile is still creating problems, which replacement by Amarok has largely avoided !

So I concur, Pulse-Audio appears to be immature, possibly linked to codec problems, but try different packages !

Yesterday I tried running the free Quake3-based game UrbanTerror.
It was a very ugly experience with lots of sound-clipping caused by pulseaudio.

Also, playing music in VLC through padsp is not entirely smooth and you can hear some occasional clipping.

Arthur Cruz (s3t-sk8) wrote :

This bug is the only thing that annoys me in this Beta x,x

It's pretty strange, I turn on my PC and open rhythmbox..
changing applications causes stuttering and pops to my music, but after some alt+tabs they stop and my music works like a charm!
I'm still trying to understand why...

sputty01 (sputty01-hotmail) wrote :

Same problem here, on my laptop AND desktop. Whether i'm using PulseAudio streaming to another network computer or even when im just playing it locally the problem still occurs, it sounds awful :(

Tested it with kernels: 2.6.24, 2.6.25, 2.6.26 and it occurs on all of them, anyone have an idea where the problem is?

sputty01 (sputty01-hotmail) wrote :

Ive just noticed it only happens for me when using the VLC plugin ... if i route all gnome sounds through pulse then the issue doesn't occur.

Jery Wang (jery-wang2002) wrote :

Mine is Dell Inspiron 1520

Core 2 Duo 2.3 GHz T7500, 3 GB RAM, Nvidia 8600GT.

It happens all the time when switching windows.

I didn't noticed it in Alpha. Only after beta it starts to occur. It does sound awful.

I am using Rhytimbox with mp3 plugin.

And to add, not just switching, even to click the text area in the firefox browser to enter this bug, will make sound stutter.

Not good.

Jery Wang (jery-wang2002) wrote :

Oh yes, it is much more noticeable when workrave block the whole full screen.

workrave is program to prevent RSI.

Dan McGuirk (incandenza) wrote :

I wonder if these changes are expected to fix this:

http://0pointer.de/blog/projects/pulse-glitch-free.html

kripken (kripkenstein) wrote :

My experience with the -rt (realtime) kernel: it doesn't help me, sadly. Bug is still present.

John Pham (jhnphm) wrote :

Haven't experienced any problems except skype over padsp,

Adjusting the settings in /etc/pulse/daemon.conf helps a bit, sounds scratchy but at least doesn't skip.

Daniel T Chen (crimsun) wrote :

This has been linked to bug 188226. Also, see comments 106, 107, and 112 in bug 192888.

Changed in pulseaudio:
status: Confirmed → Invalid
Dan Andreșan (danyer) wrote :

For me it is really simple.

Rythmbox playing a mp3 file. Minimize another application, maximize it, then alt-tab a couple of times, you'll hear music shuttering.

Close Rythmbox. Type in terminal

pulseaudio -k

Start Rythmbox. Play. Do the trick with windows. No shuttering, as hard as I try.

Simple to reproduce the bug on my computer. I can test it anytime.

Thanks,
Dan.

I noticed the same thing, but it was under Kubuntu, windows would leave a very large trail while dragging, and music would stutter . But kubuntu doesn't use pulseaudio so that's weird. But I experienced the same lag as some described above.
I'm running ubuntu now, using compiz(or gnome's composition) to make dragging a window a little more bearable.

kripken (kripkenstein) wrote :

I can confirm Dan Andresan's comment: running

pulseaudio -k

fixes this problem *completely* on my computer.

In fact I am right now for the first time since installing Hardy enjoying music while Alt-Tabbing between windows. No stuttering.

Jery Wang (jery-wang2002) wrote :

pulseaudio -k

do the job

Thanks!!!!!!

Can someone please incorporate this into pulseaudio so that the problem is fixed once for all!

Thanks again to Dan Andresan

Jery Wang (jery-wang2002) wrote :

Oh yes,

how to make

pulseaudio -k

permanently set up without doing this again and again?

Keenan Pepper (keenanpepper) wrote :

Jery Wang, I don't think you understand the situation. "pulseaudio -k" doesn't make pulseaudio do anything differently. It turns pulseaudio off completely. The "-k" stands for "kill". So asking to "incorporate this into pulseaudio" makes no sense. Turning off pulseaudio might make it sound better, but you also lose all the features of pulseaudio (like streaming over a network I guess), so I don't think the people in charge are going to make that the default.

Jery Wang (jery-wang2002) wrote :

Oh, I didn't know -k is for kill

I don't mind pulseaudio installed in my system, but do I have a choice to turn it off altogether during boot? Or I always have to kill it after login?

Listening music that skips/stutters is unacceptable. All other features that pulseaudio offers becomes useless when sound quality is bad even doing simple task like switching windows.

Ric Flomag (ricflomag) wrote :

Jery:
You can add "pulseaudio -k" to your gnome session. Menu System -> Preferences -> Sessions.

Tim Skinner (timskinner1) wrote :

if you don't want to use pulse audio why don't you just remove the package?

Ric Flomag (ricflomag) wrote :

Tim: it would remove ubuntu-desktop, which is not recommended.

Tim Skinner (timskinner1) wrote :

I haven't had time to play around with this yet, but from this developer blog http://0pointer.de/blog/projects/pulse-glitch-free.html ,

"PulseAudio <= 0.9.10 uses a fragment size of 25ms by default, with four fragments. That means that right now, unless you reconfigure your PulseAudio manually clients will not get latencies lower than 100ms whatever you try, and as long as music is playing you will get 40 interrupts/s. (The relevant configuration options for PulseAudio are default-fragments= and default-fragment-size-msec= in daemon.conf)

dmix uses 16 fragments by default with a size of 21 ms each (on my system at least -- this varies, depending on your hardware). You can't get less than 47 interrupts/s. (You can change the parameters in .asoundrc)".

It appears that pulse-glitch-free is going to be merged into the main trunk as 0.9.11 , so that may solve the problem.

Bruce R (bm007a0030) wrote :

Please see #221953.

Tim Skinner (timskinner1) wrote :

 I've tried increasing the buffer size by increasing the number of fragments and/or increasing fragment size in /etc/pulse/daemon.conf ; and giving pulse higher priority. There is also an option in daemon.conf to not limit the cpu pulse uses which I also tried. None of these seemed to have much effect. If anything, increasing the buffer size helped a little bit.

Conn O Griofa (psyke83) wrote :

As crazy as it may seem, reducing the buffer may help. Also I noticed reduced CPU usage when I manually set the sample rate to my soundcard's native rate, 48000Hz.

Try changing your /etc/pulse/daemon.conf to reflect the following changes:

; default-sample-format = s16le
default-sample-rate = 48000
; default-sample-channels = 2

default-fragments = 8
default-fragment-size-msec = 10

This has eliminated stuttering for me with both ICH4 and ICH5 (AC'97) cards, but it may vary for other soundcards. Perhaps some AC'97 based cards have a small buffer, hence if the fragment number or fragment size is too high, it cannot fit in the buffer...

Conn O Griofa (psyke83) wrote :

A good test is Skype (OSS), available from Medibuntu as skype-static-oss (as the ALSA version is not currently compatible). Run skype using the padsp wrapper, i.e.: padsp skype

With the default settings, sound skips terribly. Using the above configuration, it doesn't skip at all on my system. I have been experimenting with different values, and it seems that having default-fragments = 5 and default-fragment-size-msec = 5 is even better for my system (Dell Inspiron 510m with STAC9750,51/ICH4).

Other applications do exhibit some stutter, e.g. VLC (using pulse output) and Pidgin's notification sounds, and these stutters are drastically reduced/eliminated with the above configuration.

Tim Skinner (timskinner1) wrote :

I tried all the configurations you suggested but decreasing the buffer size just made the problem worse for me.

Nuihc88 (nuihc88) wrote :

None of the above daemon.conf settings or realtime kernel worked for me, but these did (on SoundBlaster Audigy 24bit, using CA0106 drivers):
"
high-priority = yes
nice-level = -14
no-cpu-limit = yes
default-fragments = 100
default-fragment-size-msec = 20
"
If i raise or lower the fragment size from that it doesn't work anymore, yet that alone doesn't seem to have any effect. There is still some tearing if i use multiple sound sources simultaniously for long enough time, but i can live with that.

Nuihc88 (nuihc88) wrote :

I was wrong, even though it is far better now than it was before, it's still very annoying.

Changed in pulseaudio:
status: Invalid → Confirmed
Changed in paconfig:
status: Unknown → New

I am having the same issue as Bug #223452, except with the built-in Realtek ALC882 sink for PA instead of some USB device, and using the Test Sound recording source instead of the PA one, so this is a playback issue not caused by sound input. Nothing I've tried seems to help.

goalieca (goalieca) wrote :

I can confirm this issue on my nforce4 mobo. The problem is worse when I am using compiz. I am using the real-time kernel. Perhaps compiz and pulseaudio are both fighting for the system bus.

ollie (ollie-ollie) wrote :

I can confirm this on Hardy Heron final, CPU Intel Pentium 4 (2.8gHz), 1.5 GB RAM, AC 97 onboard sound, Nvidia video binary drivers. Rhythmbox stutters, when minimizing/maximizing (compiz enabled), alt+tabbing, even while scrolling pages on firefox and basically all the time while using apt/update manager.

It's incredibly annoying. The same machine performed perfectly in Gutsy, and still does running Gutsy in a livecd session.

Daniel T Chen (crimsun) wrote :

I'm almost positive the _symptoms_ are due to bug 188226. According to the source code, PulseAudio itself doesn't seem to overoptimistically buffer. If you do not use a driver in the restricted component, please test the 17-generic kernel in hardy-proposed.

See my recent comment on Bug #188226. As such, I'll be glad to try
2.6.24-18, if it becomes available today or tomorrow.

Conn O Griofa (psyke83) wrote :

Daniel,

I'm sorry, but kernel 2.6.24-17-generic does not help with PulseAudio stuttering (although some applications appear more resistant to stuttering than others).

For example (using the default pulse settings): totem (gstreamer, using pulse) will never stutter under CPU load. VLC using pulse will produce pops and slight stutters regularly, even when the system is idle. Pidgin's notification sounds have very noticeable pops, and Skype (OSS version using padsp) will stutter badly.

The only way I have alleviated stuttering is via tweaks to the fragment settings, although it is still possible to notice slight stutters under high CPU load. I do believe the -17 kernel has helped somewhat, but there is still a problem with the default buffering.

kripken (kripkenstein) wrote :

I tried the 17-generic kernel just now, and oddly enough I can't get sound to work in it. It detects no sound devices. So, no way for me to test if it helps with this bug.

Back to 16-generic, and sound works, but stutters and pops as per this bug.

Conn O Griofa (psyke83) wrote :

kripkenstein,

That's probably because you didn't install the "linux-ubuntu-modules-2.6.24-17-generic" package manually. The "linux-generic" metapackage usually gets uploaded after all packages are built and ready (including the restricted-modules). I don't think everything is ready yet, so you need either to manually install packages or just wait.

Daniel,

Previously I suggested to change the sample rate to 48000Hz (the native rate of my card), and despite using less CPU it seems to cause very slight stutters in VLC when playing an audio stream of 41000Hz. Leaving it at the default rate seems to eliminate stutters completely* for me in all applications, when I add my user to pulse-access and pulse-rt (shouldn't this be made the default behaviour>) and have the following set in /etc/pulse/daemon.conf:

high-priority = yes
default-fragments = 8
default-fragment-size-msec = 5

*I'm sure these settings are heavily card-dependent. This is mine:
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 01)

A few days ago I posted on Ubuntu Forums replying to a post on stuttering audio, and suggested a modified daemon.conf (different to above, but still lower than the default). Some have noticed the problem reduce, disappear or get worse. See here: http://ubuntuforums.org/showthread.php?t=766860

I would suggest that we do some extensive testing and figure out how to get this problem resolved for everyone.

kripken (kripkenstein) wrote :

Conn: Thanks, you were right, I was missing the -modules- package.

Ok, I am very happy to report that this bug appears to be fixed for me in the 17-generic kernel. Nice work!

Wow , its fixed for me also after installing the new kernel 2.6.24-17-generic, thats great , I'm not sure who suggest this but many thanks to him.

Tim Skinner (timskinner1) wrote :

I can confirm that this is fixed for me for the new -17 kernel. I downclocked my cpu and opened about 20 windows to test and found no stutter. I think I read in the update description that this was meant to be fixed. I would suggest changing the bug status once this is the default kernel.

Conn O Griofa (psyke83) wrote :

Tim,

Although the original reporter reported the issue fixed, it's not fixed for me yet. Perhaps it's better to wait for some more feedback to see if more steps need to be taken.

Some more feedback here:

The good:
2.6.24-17-generic seems to have fixed the issue for Rhythmbox, Totem (GStreamer) and mplayer.

The bad:
Pidgin's notification sounds still stutter though.

kripken (kripkenstein) wrote :

Correction to my previous comment: While 17-generic greatly improves the situation, and solves it for many usage scenarios, it doesn't fix everything. After several days use, I found a small case or two in which it still happens (e.g. iconifying/deiconifying Deluge to the notification area while Sound Recorder is playing - probably the issue is it takes Deluge a lot of work to redraw itself, but I don't know).

So, the new kernel is a big improvement, but not a complete solution.

Tim Skinner (timskinner1) wrote :

I agree with kripkenstein; that for me, at least, 17- is a great improvement, but I still hear odd pops now and then when using amarok

Benjamin Thyreau (benji2) wrote :

This may be related to lp bug #211052 , as Conn's comment implies it may related to a samplerate bug.

Josh Green (josh-resonance) wrote :

I'm also experiencing audio stuttering and wanted to contribute my findings. I'm using Ubuntu 8.04 with the rt kernel.

First off, I think there are many sources of this problem which all result in audio drop outs, which is likely why this bug has become so confusing. I was also experiencing various issues with PulseAudio, so I have completely disabled it and am now using ALSA dmix. For this reason, I should probably be filing this under another bug, which I will do as I gather more information.

In my case, the audio drop out issue does not occur with applications like MPlayer, Amarok and aplay. I also tried VLC, which suffers very slightly from this issue (which I suspect is another issue). Rhythmbox, Totem, and Sound Recorder on the other hand are really bad. Minimizing/maximizing windows causes a rather large audio drop out about 50% of the time. This lead me to believe there is something wrong with gstreamer. So I decided to try gst-launch:
gst-launch-0.10 filesrc location=test.mp3 ! mad ! audioconvert ! audioresample ! alsasink

Indeed, this gstreamer pipeline has the same audio drop out behavior as all the other applications using gstreamer. I also tested ogg files with a gst-launch pipeline, with the same poor results. So in this case, I think I am experiencing some issue involving gstreamer. I'll be sure to post any more info as I discover it.

Josh Green (josh-resonance) wrote :

Just a follow up on my previous post concerning stuttering with gstreamer and ALSA. Sorry if its a little off topic (not directly related to PulseAudio). I was able to get gstreamer based applications to not drop out anymore by increasing the buffer size. With gconf-editor add the parameter "buffer-time=400000" (for 400ms buffer size) to the audiosink, chataudiosink and musicaudiosink keys in /system/gstreamer/0.10/default. So the key values should look like:
alsasink buffer-time=400000

The default is 200ms though, which seems like more than enough. This suggests that there is something more sinister going on in regards to latency (as others have suggested). I think the nvidia driver is a good candidate, since it seems like it most often occurs when doing min/maximize of windows and not when other non graphics processes are consuming all of CPU (at least in my case).

Krzysztof Kosinski (tweenk) wrote :

Another workaround: Put this in /etc/asound.conf

pcm.pulse {
        type pulse
}
ctl.pulse {
        type pulse
}
pcm.!default {
        type pulse
}
ctl.!default {
        type pulse
}

In System->Preferences->Sound, configure everything to use ALSA.
This completely eliminates the stutter for me. Additionally, this restores the ability to route sound over the network with GStreamer apps (bug #211016). This suggests that something may be wrong with GStreamer, not Pulse.

Krzysztof Kosinski (tweenk) wrote :

Followup about the previous workaround:
If I change desktops or do something that causes a redraw of a large portion of the screen when playing sound on a remote server, there is a quite large probability that Rhythmbox will hang completely and will have to be killed. I used PulseAudio the same way in Gutsy, and Rhythmbox did not hang.

Connor Imes (ckimes) wrote :

I agree that this is a pulseaudio problem, switching amarok to ALSA from Autodetect has fixed the problem for me.
On a side note, the problem did not exist in the 64 bit install of Hardy I had on this machine, but did occur in the 32 bit install.

Conn O Griofa (psyke83) wrote :

Krzysztof,

Regarding the crash you're experiencing, please see bug #198453, and try updating your libasound2 and libasound2-plugins packages to see if it solves your particular problem. See my comment here: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/198453/comments/65

Nuihc88 (nuihc88) wrote :

The new kernel seems to have completely removed my stutter problem.

The pops appear to be a completely different problem (they only happen when reserving an audio device), but that doesn't bother me at all.

Krzysztof Kosinski (tweenk) wrote :

@Conn: From the limited testing I have done it seems that installing the updated libasound2 packages fixes _both_ the stutter and the Rhythmbox hangs when playing over the network. I can run 2 instances of yes > /dev/null while playing on a remote server and there is completely no stutter even when switching desktops. Thank you very much for solving my problem!
BTW, I think the libasound2 packages should be provided at least as a backport in the Ubuntu repos.

Daniel T Chen (crimsun) wrote :

alsa-plugins and alsa-lib should be backported from intrepid (hardy-proposed is not appropriate due to the invasive changes in alsa-lib, and alsa-lib 1.0.16 is required for alsa-plugins 1.0.16).

Can someone reproduce the symptoms using -generic with "nohz=off" appended to the kernel command line? (either modify on live boot, or edit your bootloader's conffile appropriately)

Daniel T Chen (crimsun) wrote :

Conn, you're correct in presuming the effect of the fragment settings are highly dependent on audio hardware. (Please note that lspci -v information is insufficient to diagnose; one needs to provide lspci -nv|grep -A1 040[13]. It's the SSID that's important. Or, provide the codec dump in /proc/asound/card*/*codec*.) For that reason, it is not possible to completely resolve the symptoms on all hardware with one set of default fragment parameters.

Marking the linux task fix committed (I'm of a mind to mark the pulseaudio task invalid because of the intractability of all codec&dsp playing nicely with one default configuration).

Changed in linux:
status: New → Fix Committed
Changed in pulseaudio:
status: Confirmed → Incomplete
Conn O Griofa (psyke83) wrote :

Daniel,

Thanks for not marking the pulseaudio task invalid yet, as I have a theory as to why some applications stutter.

If you can bear with me by installing the Debian unstable versions of libasound2/libasound2-plugins and run pulseaudio in verbose mode, it exposes some odd behaviour for certain applications:

Skype (ALSA version, preconfigured to use the "pulse" device in Options): When you launch Skype, it opens and closes 57 client connections just to play the 3 second "startup" sound (which plays, albeit with stutter). Starting a call to "test123" works, yet it causes about a dozen client connections *per second*. This behaviour does not seem correct to me. I think that my earlier theory re: lowering the buffer helped this situation as each new client connection did not have to wait as long for a buffer to fill, therefore the sound did not appear to stutter as badly.

SDL application using libsdl1.2debian-pulseaudio (i.e. neverball): opens one client connection in PulseAudio that remains stable.

SDL application using libsdl1.2debian-alsa* & configuration from bug #198453: opens and closes approximately two connections per second (much less than Skype, but surely this is not correct behaviour).

(By the way, neither Skype nor SDL applications using the -alsa backend work with Hardy's libasound2/libasound2-plugins).

It seems there is still a problem in PulseAudio and/or the pcm_pulse ALSA plugin (even if updated to Debian's version) that can cause symptoms that appear to be buffer underruns, and should be investigated.

Conn O Griofa (psyke83) wrote :

Daniel,

I rebooted kernel 2.6.24-17-generic with the parameter nohz=off, and, using the default PulseAudio configuration, stutters continue. Easily reproducible by playing a movie in VLC and moving around its window or minimizing/maximizing Firefox simultaneously. In fact, it stutters even when the system is otherwise idle.

conn@inspiron:~$ lspci -nv|grep -A1 040[13]
00:1f.5 0401: 8086:24c5 (rev 01)
 Subsystem: 1028:0164

Vytas (vytas) wrote :

Same here.
Installed corresponding alsa packages from intrepid, so skype and some other stuff now works under PA, but sound from some apps (like Skype, sdl-pulseaudio) is stuttering.

Kernel 2.6.24-17-generic helped a little or not at all, hard to tell exactly, but it doesn't solve the issue. I rarely have processors fully used, so this stuttering has nothing to do with system load - system may be even idle.

I have a Dell Latitude D620 laptop, Intel HDA audio card (output from lspci):

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)
 Subsystem: Dell Unknown device 01c2
 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B-
 Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
 Latency: 0, Cache Line Size: 64 bytes
 Interrupt: pin A routed to IRQ 20
 Region 0: Memory at efebc000 (64-bit, non-prefetchable) [size=16K]
 Capabilities: <access denied>

I changed the config in /etc/pulse/daemon.conf as suggested somewhere in the forums (probably written by Conn), by appending:
default-fragments = 8
default-fragment-size-msec = 5
...to this file.

I am not sure what these values are, because buffer of 5 msec seems small to me, is the default even smaller?

Anyway, this fixes my issues - pulseaudio is now very smooth.

Thiago Teixeira (tvst) wrote :

I get the same behavior as just about everyone else here, but I do not thing it's a PulseAudio issue. At first it did seem it was Pulse-related, since thinks worked smoothly when I killed the PulseAudio daemon and used ALSA instead. That is, I could play music, Alt-Tab, switch desktops, listen to audio from Flash sites, all at the same time.

However, when I listen to music with Rhythmbox and play a movie in Totem (even if the movie is paused) I can produce glitches on the music by Alt-tabbing, switching desktops, etc.

I'm on a Pentium M 1.73MHz, with 1GB RAM, Mobility Radeon x300 (fglrx), 2 soundcards (one internal, one USB) and no compiz.

Since I never use the internal card, I don't know if the glitches happen only on the USB one. I will test that and report back.

Thiago Teixeira (tvst) wrote :

Oh, and this is a clean Hardy (release version, not beta) install.

Thiago Teixeira (tvst) wrote :

Actually, this seems to have something to do with my dmix setup. When I remove everything from my asound.conf (well, I just keep the lines that make my USB sound card the default one) everything works without glitches.

But I get no software mixing :(

Conn O Griofa (psyke83) wrote :

tvst,

Firstly, enable the hardy-proposed repository and grab version 2.6.24-17-generic of the kernel, that may help eliminate stuttering (even without PulseAudio). Also, your comments re: removing your asound.conf seem odd. As far as I know, dmix is setup by default in ALSA when no asound.conf file is present.

huiii (a00ps) wrote :

some usb cards NEED asoundrc, otherwise ALSA has no clue how to deal with it.
my alesis io|2 worked just with asound configured under ubuntu gutsy but under hardy it goes without.
anyway,
since hardy i am experiencing a lot aof issues.
one of them is rhytmbox in combo with browsing the net with firefox.
sound stops for a moment when i switch between tabs inside the browser.
Xorg shoots up to 100% CPU for a moment.
the funny thing is:
its running on a intel 2ghz 2duo, 2gb ram, sony vaio, xubuntu hardy 8.04 64bit, 2.6.24-16-rt.
compiz is on.
i tried "pulseaudio -k":
it is slightly better, but after a while when wild-tabbing inside firefox, rhythmbox will interrupt sound again. viewing "top" reveals dramatic increase of CPU through Xorg up to 100%.
on my system is not just rhythmbox that stutters:
if u use brasero and burn a cd while watching a film or listen to music in any player everything will shutter, spit and chopp till cd burning is finished. compiz-animations are than affected, too.
again viewing "top" reveals dramatic usage of CPU of Xorg by 100%.
my guess is that we are dealing here not just with one bug.
changing buffersizes is like opium for tooth-pain, it minimizes the symptoms but does not fix the cause(s).
it might be linked to some changes / bugs that came together
-in the kernel,
-in ubuntu hardy
-in pulseaudio
-gstreamer
-in Xserver
-in compiz
??
where should i start?

Max Randor (max-randor) wrote :

I don't think it is Compiz as I have this problem and compiz is not enabled.

I no longer get this problem while tabbing (even in firefox - this does eventually push the CPU up to 100%), but when something ram intensive (like hugin stitching photos together) is occurring there is lots of stuttering.

I am still waiting for the new kernal etc. to make it into the normal updates/backports repository - is that likely to happen in the near future?

There might be something in Xorg - It seems to take longer to render windows than it used to.

But you are probably right - It might be bigger than just pulseaudio - but hopefully the next version of pulseaudio will fix the problem and hide the other bugs until later :-)

Thiago Teixeira (tvst) wrote :

"As far as I know, dmix is setup by default in ALSA when no asound.conf file is present."
Conn: that's what I thought too (that's what the ALSA wiki says). But my experience is that I get not software mixing unless I specifically add dmix to asound.conf , and I tried this on 3 completely different computers (where only one had more than one sound card) and at least 3 different Ubuntu versions. That's one of the reasons PulseAudio is so interesting to me. It makes software mixing easier to set up, plus adds individual volume control for each stream, and lets me easily select the default soundcard.

I will try the proposed kernel and will report back.

Thiago Teixeira (tvst) wrote :

I just booted with the 2.6.24-17 kernel, and there's no audio at all. In fact, there's no /proc/asound, so i can't even list the contents of /proc/asound/cards. Similarly, the Device selectbox in System>Preferences>Sound is empty.

Also, I just went to my other laptop (also clean hardy install, but different machine) using the default generic kernel and saw that there's no stuttering/pops with the internal audio card no matter what I do. The other machine is a Thinkpad T60, Core 2 duo, ATI mobility radeon x1300 (fglrx), 1.5GB RAM. I'll try connecting it to the USB card and see what happens.

Thiago Teixeira (tvst) wrote :

Actually, about the "no soundcards" thing: I think I forgot to install some modules. brb :)

Thiago Teixeira (tvst) wrote :

Ok, at a first glance the new kernel (2.6.24-17) seems to fix the audio issues I was having with Pulseaudio. I'll keep you posted if I notice any problems. Thanks for the help!

huiii (a00ps) wrote :

i have done that, updated this morning to the proposed repo, 60 updates altogether plus 2.6.24-17-rt.
overall performance got better, had suddenly old bug known from gutsy wuth switching to virtual console (blanck), solved like in gutsy by adding vesafb, but all in all it runs smoother.
I GOT still the problems as explained before and i think we got prolems with Xorg.
look to your CPU-usage of Xorg when listening to music and browsing the net.
it goes up like uhuh just by switching tabs and still lets my sound breaks / stops / for a sec.
no guys, this issue is NOT SOLVED with new kernel.
but thx anyway.
:)

Gaspard Leon (gaspard.leon) wrote :

Well, I've finally upgraded to the release version of Hardy (blew away my beta version)
with freshly installed hardy (+ updates) it seemed fairly reasonable, wasn't seeing too many slowdowns... until I started using it a bit more..

So I upgraded to the proposed 2.6.24.17.19 kernel... much improved responsiveness!! firefox seems to scroll properly now =)
but pidgins little notification sounds were still popping?!!

So I followed psyke83's directions in the thread http://ubuntuforums.org/showthread.php?p=4928900
(except the equalizer part, I added all the fixes there, updated libasound, added /etc/asound.conf file, added buffer changes to /etc/pulse/daemon.conf)

Now the pidgin sounds are fine and I'm testing rhythmbox as I type this, and have been satisfied... there are no pops even using flash and multi-tab firefox.

huiii (a00ps) wrote :

thx to gaspard leon for the link,
it is getting much much better after following step C.
(64bit)

Can everybody please try the version of pulseaudio in my ppa, linked to below? I've changed the fragment size settings, and have found particularly for stuff using the pulse alsa-plugin, that performance has been improved. Please report back with feedback:

deb http://ppa.launchpad.net/themuso/ubuntu hardy main

Thanks.

huiii (a00ps) wrote :

hello,
i followed by now more or less the suggestions / links mentioned in this thread:
things got better in general. latest updates seem to fix some related stuff too.
adding the deb http://ppa.launchpad.net/themuso/ubuntu hardy main
to the repo list did update the pulseaudio stuff. nevertheless I am still experiencing some symptoms discribed above:
when listening to rhythmbox while browsing the net with firefox, switching fro tab to tab can cause interrupts in playback.
anyone experiencing this?

Tim Skinner (timskinner1) wrote :

I am still experiencing this bug when running updates (maybe update manager is cpu hungry)

After the updates I still experience stutters when new packages are being installed whether that be from synaptic, update manager or command line. I don't get any noticeable stutters with any other high CPU usage except for the situation mentioned above of course.

Max Randor (max-randor) wrote :

@ Richard Mayhew

That is most likely because update-manager etc a lot of RAM (not all at once but they have a high change in ram/s)
Or at least my RAM usage graph wiggles a lot more when update-manager/ apt-get is running so I assume this is the case.

High CPU usage + high RAM usage = stuttering - at least for me.

Try running some programs that take CPU usage up to 100% and then start firefox and open office at the same time.

Just update my Hardy and got the 2.6.24-18 kernel: it fixed the problem
and even under heavy stress (transmission, azureus (java), evolution,
firefox, amarok, synaptic) no shuttering occurs in _any circumstance_. I
got the new kernel from the hardy-updates repository.

Great!

OK i have tried to re-create the stutter with using apt-get under high CPU stress and RAM load but not managed it yet. I guess when i did get it there were some particular updates that caused the stutter. Looks like it is fixed, thanks guys.

joshlukas (joshlukas) wrote :

Not fixed for me. :( I thought the same as I updated to the new 2.6.24-18 kernel. For about four, or five hours no shuttering, and then it just occured again and cant't be fixed till next reboot. :( Have tried to build my own kernel 2.6.25-4 with and without rt patch. Tried to set it to server kernel for high latency. It just won't stop music beeing skipped while I'm interacting with my computer in any way. It occures even if typing a text in some forums, texteditor, so the system is idle. :(( I tried to make some modifications to pulse as follows: http://aryuna.de/spdif_mit_ubuntu_hardy_und_audiophile_2496

Josh Green (josh-resonance) wrote :

I just upgraded to 2.6.24-18 kernel as well. At first I was using the rt kernel, which did not behave any better in regards to audio drop outs (than previous versions in Hardy). Of note is that I'm NOT using PulseAudio, but just plain ALSA. I then tried the regular 2.6.24-18 kernel and I have yet to been able to get Rhythmbox to drop out. Using a small test application I wrote which does system calls like malloc() and chdir() and times how long they take, I found that running this app as a normal user with the rt kernel can spike up over 400ms for system calls when doing things like minimizing/maximizing windows, whereas the generic 2.6.24-18 kernel max is under 80ms. I believe the default gstreamer buffer size is 300ms. So there still exist some differences between the rt and non-rt 2.6.24-18 Ubuntu kernel which are causing rather significant system call latencies. Of note though, is that SCHED_FIFO audio applications are able to run on my system with the rt kernel at sub 4ms latency, without issues, so the problem is for the SCHED_OTHER normal user case. I was previously using the rt kernel in Gutsy without these issues, so there is likely still something to be fixed in the latest rt kernel.

the .18 kernel update didn't fix the problem for me either. still crackling sound when arriving pidgin or cgmail notifications.

Changed in paconfig:
status: New → Invalid
huiii (a00ps) wrote :

might this be related to Xorg? in conjunction with other bugs / "de-optimizations" here and elsewhere?
I find it very demanding, lately..
scrolling firefox, openoffice, thunderbird, skype, switching tabs, minimizing, maximizing, etc.. peaks Xorg to exaggerated CPU-usage... it got better in average, dropouts of sound became rare, but i find it altogether worse than under gutsy on slower laptop.

Karl Frisk (karl-frisk) wrote :

not fixed for me as well. pulseaudio has still to be turned off here.

Conn O Griofa (psyke83) wrote :

PulseAudio's resample-method in Ubuntu is currently set to "speex-float-3", which uses a high amount of CPU when a client uses a different sample rate than the server.

Here's an example: if you play a 48Khz mp3, it has to be downsampled PulseAudio's default rate of 44.1Khz. On my system, the pulseaudio process takes up a ridiculous amount of CPU in such a case, usually between 15-20% on my Pentium M 1.5Ghz system. On the other hand, playing a 44.1Khz mp3 causes pulseaudio to use around 5-10% CPU on average (as it uses the resample-method "copy", which is no resampling at all).

Unfortunately, PulseAudio cannot change sample rates dynamically (see http://www.pulseaudio.org/ticket/262 ), so we can mitigate this high CPU load by using a faster resampler. I propose that we use the "speex-fixed-0" resample-method, as it reduces pulseaudio's average CPU usage from ~15% to ~10% when resampling.

See Mandriva's bug report here: https://qa.mandriva.com/show_bug.cgi?id=36084
Their resolution to high CPU usage was to change the resample-method to "speex-fixed-0".

Conn O Griofa (psyke83) wrote :

Ok, a quick follow-up to my previous post.

I played a movie (Blade III, audio at 48Khz and PulseAudio server at 44.1Khz) as a resampling test and I could hear crackling (that's unrelated to buffering) during explosion sequences. It seems the resampler "speex-fixed-0" causes some crackling distortion only at high volumes. I tried "speex-float-0" and there is no crackling or distortion even at the loudest volume, and CPU usage is still less than "speex-float-3". At the very least I think someone responsible for PulseAudio in Ubuntu and/or with high-end audio equipment should do some experiments with these resamplers, because at the moment PulseAudio is using an excessive amount of CPU.

Paul Drain (pd) wrote :

Just tried this myself, on a 2.2Ghz Core 2 Duo laptop, i'm getting 8% CPU using the default settings, with a noticable crackling/static sound at higher volumes (90 or above) -- so after reading this bug, I ran some tests to see if I could stop the pops.

The best result I found was speex-float-1, which caused no crackling on a HDTV .wmv file using the Flumotion binary WMV codec via Totem, at ~3-4% CPU instead, speex-float-0 caused the same file to playback slowly (although, rewinding or fast-forwarding through the movie caused the movie to play normally for around 30 seconds before the slowdown appeared again).

So CPU use was about the same using float-0 and float-1 here, float-1 caused no lag (if that's the right way to describe it) though.

Would it be worth running the same tests using -fixed-X?

Jamie Strandboge (jdstrand) wrote :

After upgrading to Hardy some time ago, I found that when doing my regular development work, audio stuttering was all too often the norm (extremely annoying). This seems to happen not only with CPU-intensive tasks, but IO-intensive ones.

I stumbled across this bug this morning, and tried speex-float-0 which almost completely solved my audio issues, with having only 3 skips in 10 minutes (before, I might have that many in 15 seconds). My testing consists of running four concurrent compilations of evolution with 5 kvm virtual hosts doing various activities. This is on a dual core with 2GB of RAM (but 1.25GB taken by virtual machines). This was easily enough to cause audio extensive stuttering before.

I am not sure what the default should be as my use case is atypical, but it is clear that this configuration option should *at least* be more discoverable (maybe in release notes or other documentation).

Pacho Ramos (pacho) wrote :

Will this be fixed for hardy 8.04.1 at least? There are some known bugs (with already included fixes or workarounds) related with pulseaudio that are still unfixed

Thanks

Jamie Strandboge (jdstrand) wrote :

Marking as confirmed as it is affecting many people and people responded to Luke's request to try his PPA packages.

Changed in pulseaudio:
status: Incomplete → Confirmed

Adding paconfig to the bug was an accident; paconfig is unaffected.

Changed in paconfig:
status: New → Incomplete
Changed in gst-plugins-good:
status: Unknown → New
Changed in pulseaudio:
status: Unknown → Fix Released
Hrotkó Gábor (roti-al) wrote :

Hi!

 My pulseaudio stuttering problem solved by adding myself to the pulse-rt group by entering:

sudo usermod -a -G pulse-rt $USER

Afterthat: log out and log in.

My soundcard:

$lspci | grep audio
00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)

Roti

HI!

i solved my scrachy sound.
Try to set in your daemon configuration file | Resample-methods= trivial |
Now i have simoultaneus output and nothing interruption of sound.
i hope that this help someone..

bye, tyrchyus

Daniel T Chen (crimsun) wrote :

Demoting importance due to known workaround. Definitely should be considered for 8.10 alpha 6, as the change is trivial.

Changed in pulseaudio:
importance: Medium → Low
status: Confirmed → Triaged

@Daniel

Could you please point to the trivial change that you believe needs to be made. It is not clear at all from the thread. A number of completely different workarounds have been posted. There's a lot to wade through here. If someone could provide a summery, pointing out the proposed change, it would be much more likely that a developer would act on this.

I also notice that you have declined the Hardy task. If the change is trivial, wouldn't it be useful to submit a update to hardy-proposed?

Please note that I personally have not experienced this issue in some time....

Tim Skinner (timskinner1) wrote :

I haven't experienced this in Hardy for a while. But when I fresh installed Intrepid beta, this seems to have become an issue again. Has a fix been commited?

Pacho Ramos (pacho) wrote :

Mandriva is changing resampling method with this patch since months ago, and work really great (well, in general mandriva pulseaudio implementation works much better than ubuntu one, I am not suggesting that pulse maintainer in ubuntu is bad or something else, I am simply suggesting maintainer to see how mandriva is solving most of opened issues related with pulseaudio for getting them also in ubuntu hardy and intrepid)

You can go to:
ftp://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/devel/cooker/SRPMS/main/release

and check pulseaudio src.rpm for more info

Thanks

Tim Skinner (timskinner1) wrote :

to clarify further, this has become worse for me in Intrepid; it appears not to be fixed and worse still, pulseaudio now seems to crash under high cpu load.

Patricio (patricio-stwing) wrote :

Just to confirm, same problem here.
When I scroll in Firefox, the sound gets choppy
Thanks!

Patricio (patricio-stwing) wrote :

So... how do I change the sampling method to speex-fixed-0 ??
Thanks!

Patricio (patricio-stwing) wrote :

sudo usermod -a -G pulse-rt $USER
seems to work

Ludovic Claude (ludovicc) wrote :

@Patricio:
sudo nano /etc/pulse/daemon.conf
enter your password, then change the line with resample-method to
   resample-method = speex-float-0

Motin (motin) wrote :

I get this output (repeated a zintillion times) from pulseaudio -vv when making Skype calls:

I: client.c: Created 3562 "Native client (UNIX socket client)"
I: protocol-native.c: Got credentials: uid=1000 gid=1000 success=1
I: protocol-native.c: Enabled SHM for new connection
I: client.c: Client 3562 changed name from "Native client (UNIX socket client)" to "ALSA plug-in [skype.real]"
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
I: client.c: Freed 3562 "ALSA plug-in [skype.real]"
I: protocol-native.c: connection died.

Is this the same bug or a new one?

Daniel T Chen (crimsun) wrote :

Motin, a different bug.

Matthew Harris (mnharris) wrote :

I added my bug report to this, but I should have pointed out that it started with my upgrade to jaunty. It seems to be very close to the problems that I had with audio when I upgraded to intrepid.

Hugo Alvarado (hugo102) wrote :

Hello,

I have been having this same issue, I tried sudo usermod -a -G pulse-rt $USER as suggested above, did not work. I disabled wifi and immediately stutter stopped and sound is perfect.

linux mint - release 6 felicia (ubuntu based) with gnome

No LSB modules are available.
Distributor ID: LinuxMint
Description: Linux Mint 6 Felicia - Main Edition
Release: 6
Codename: felicia

Linux hugo-laptop 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux

hugo@hugo-laptop ~ $ free -m
             total used free shared buffers cached
Mem: 1956 1897 58 0 41 632
-/+ buffers/cache: 1224 732
Swap: 486 7 478

00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
02:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)

Daniel T Chen (crimsun) on 2009-02-14
Changed in pulseaudio:
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 0.9.14-0ubuntu6

---------------
pulseaudio (0.9.14-0ubuntu6) jaunty; urgency=low

  * 0004_disable_autospawn.patch: Disable this patch. Doing so
    allows the daemon to spawn if not already running, which
    works around LP: #191027, #204272
  * 0012_clarify_driver_error_redirect_to_alsa_devs.patch:
    - Only log POLL* being set if tsched is used so that syslog
      isn't filled with innocuous messages when we set tsched=0
      (see 0030 below) (LP: #323712),
    - Hint 'linux' source package instead of 'alsa-driver' for
      Launchpad bug reports,
    - The debug-specific portion is only applicable to 0.9.14;
      0.9.15 enables a rate limiting module by default to work
      around this (and other) issues
  * 0029_fix_suspend_on_idle_null_race.patch: Handle sink case,
    too
  * 0030_set_tsched0.patch: Work around a shedload of (driver)
    bugs by falling back to interrupt-based buffer semantics
    (LP: #190754, #292880, #295519, #298494, #301755, #302964,
     LP: #319118, #323976, #324103, #326205, #326864)
  * Backport fixes from git HEAD:
    - 0031_fix_6chan_map.patch,
    - 0032_reinit_proplist.patch,
    - 0033_fix_pa-gcc-packedmalloc.patch,
    - 0034_bt_fixes.patch
  * Make invoking the stop target in the initscript not fail an
    upgrade (LP: #317921)
  * Previous upload (0.9.14-0ubuntu3) fixed LP: #321357
  * 01PulseAudio: use sudo -H to ensure that $HOME is, in fact,
    the user's when invoking pacmd for suspend/resume

 -- Daniel T Chen <email address hidden> Sun, 15 Feb 2009 02:35:26 -0500

Changed in pulseaudio:
status: Fix Committed → Fix Released
Connor Imes (ckimes) wrote :

I'm closing this task against paconfig since this bug was fixed in the pulseaudio package. Thank you.

Changed in paconfig:
status: Incomplete → Invalid
Daniel T Chen (crimsun) wrote :

released in jaunty's -11.38

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Changed in gst-plugins-good:
status: New → Fix Released
Changed in gst-plugins-good:
importance: Unknown → Medium
Changed in pulseaudio (Mandriva):
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.