PulseAudio causes sound latency in 8.10

Bug #294666 reported by Jordy van Heeswijk
56
This bug affects 8 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Expired
Undecided
Unassigned
Nominated for Jaunty by Daniel T Chen

Bug Description

Binary package hint: pulseaudio

Since I upgraded to Ubuntu 8.10 (i386), I experience noticeable sound latency in all games I've tried thus far.
In 8.04 and earlier sound in, for example, the games Briquolo and Pingus was perfectly in sync. Now in 8.10 it lags about half a second behind.

I can solve the latency problem by issuing the following command in the terminal:
sudo killall pulseaudio

But as you can understand I'd prefer a somewhat neater solution...

Revision history for this message
Daniel T Chen (crimsun) wrote :

Is this symptom still reproducible in *current* 9.04?

Changed in pulseaudio:
status: New → Incomplete
Revision history for this message
pymike (pymike) wrote :

I'm not sure, I have Ubuntu 8.10.

The delay issue disappeared after I logged in (was still messed up when I first logged in) and out and in after rebooting my computer. However in my pulseaudio process the "Waiting Channel" says "futex_wait", any idea what that is?

Revision history for this message
Psy[H[] (vovik-wfa) wrote :

On jaunty Alpha 4 there is still very large delay with pulseaudio: some 0.2-0.5 seconds

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

The strange thing is not all applications seem to be affected by this. Media players like Totem, Media Player, VLC etc work fine. It's mostly games that experience sound latency. World of Goo is an exception to the rule however. I installed this game yesterday (I'm still running 8.10), and I didn't have to kill pulseaudio to play the game without sound latency.

Revision history for this message
pymike (pymike) wrote :

Jordy, maybe because they're binaries? :S

I've also noticed that Audacity hasn't been working since I've experienced this problem. (It's refusing to play sounds, but I can still export and import sounds without problems)

Hope this problem is fixed soon :-(

Revision history for this message
Luke Yelavich (themuso) wrote : Re: [Bug 294666] Re: PulseAudio causes sound latency in 8.10

If those games you are trying to play use SDL, you may want to consider installing libsdl1.2debian-pulseaudio, which will use pulseaudio as an output directly, instead of going via alsa then through pulseaudio, which could indeed introduce latency.

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

> Jordy, maybe because they're binaries? :S
But games are binaries too, as well as for example Totem, VLC etc., aren't they? To be honest I don't really understand what you're trying to say here.

> If those games you are trying to play use SDL, you may want to consider installing libsdl1.2debian
That didn't work unfortunately. Is there an easy way to determine which sound architecture a certain program uses?

Revision history for this message
pymike (pymike) wrote :

> But games are binaries too, as well as for example Totem, VLC etc., aren't they? To be honest I don't really understand what you're trying to say here.

Well, I remember on Windows *shudder* that older (or newer) binaries weren't affected by other problems I'd have. Just a wild amateurish guess ;-P

Revision history for this message
Daniel T Chen (crimsun) wrote :

You can see which libs it links against, although that's not foolproof either.
--
Sent from my Android phone with K-9. Please excuse my brevity.

Revision history for this message
Psy[H[] (vovik-wfa) wrote :

on jaunty alpha 5 latency is still very high: 135-355ms for alsa apps.

Revision history for this message
Psy[H[] (vovik-wfa) wrote :

...no change in alpha 6

Revision history for this message
Jamin W. Collins (jcollins) wrote :

Frequent latency here as well with fully updated Jaunty.

Revision history for this message
Jamin W. Collins (jcollins) wrote :

I see that this report is marked as Incomplete, it appears that this was done when asking if the problem still occurs in Jaunty. As myself and others have confirmed it does, I'm changing the status to Confirmed.

Changed in pulseaudio (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Daniel T Chen (crimsun) wrote :

There's no real need for an SRU (jaunty) for this symptom; I'm only using it to track the related bug in linux (bug 345627).

Revision history for this message
Daniel T Chen (crimsun) wrote :

upstream git does not have this symptom

Changed in pulseaudio (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Jamin W. Collins (jcollins) wrote :

I think you may have posted to the wrong bug report. There's no mention of an SRU in this report and the bug you link to is for crackling not latency/lag.

Revision history for this message
Daniel T Chen (crimsun) wrote :

The pcm_lib mid-layer changes address both symptoms.

On Apr 23, 2009 3:55 PM, "Jamin W. Collins" <email address hidden>
wrote:

I think you may have posted to the wrong bug report. There's no mention
of an SRU in this report and the bug you link to is for crackling not
latency/lag.

-- PulseAudio causes sound latency in 8.10
https://bugs.launchpad.net/bugs/294666 You received thi...

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

> The pcm_lib mid-layer changes address both symptoms.
I still experience sound latency in Jaunty (x86). Do these changes still have to be applied to Ubuntu? If so, when is this going to happen?

Revision history for this message
Lars Volker (lv) wrote :

I experience the same behaviour in Karmic. Flash games and games running locally (like smc) are affected by a ~ .5 seconds delay. Any progress on this?

Revision history for this message
Oleksiy Lukin (alukin) wrote :

Besides it,even in Karmic, such programs as stardict+espeak are "swallowing" sound.

Revision history for this message
Psy[H[] (vovik-wfa) wrote :

In karmic with latest updates I still have random 100-400ms latency:
171833 μs (= buffer: 110000 μs + sink: 61833 μs)
271866 μs (= buffer: 182471 μs + sink: 89395 μs)
477530 μs (= buffer: 391519 μs + sink: 89395 μs)
all with single app.

sink latency randomly switches from 40 to 90 ms.

Is it possible to get rid of this buffer to reduce latency to acceptable levels, like that of pure alsa (~40ms)?

Revision history for this message
Psy[H[] (vovik-wfa) wrote :

marked as fix committed on 2009-04-23...
Any news?

On karmic with current updates latency is still high.
Erratic sound timing is also present: Fast repetitive sounds in some apps are being played back with uneven intervals. Take for example chaingun in doom (vavoom port). A huge difference if played with and without pulseaudio.

Revision history for this message
Daniel T Chen (crimsun) wrote :

Fixed in 10.04

Changed in pulseaudio (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

I still experience sound latency in Ubuntu 10.04 x64.
I must say though that lag seems to have disappeared for quite a number of games.
But flash games remain a problem.
Take http://www.onlinegamesquad.com/?1085-1 for instance. It's quite noticeable when playing this game.

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

Addition: as far as sound latency is concerned, the situation seems to be equal to that in Karmic.

go2jimmys (jim850000)
Changed in pulseaudio (Ubuntu):
status: Fix Released → Fix Committed
Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

Flash games still suffer from sound latency in Ubuntu 10.10 x86. In all other cases, this issue seems to have been fixed.

Revision history for this message
Brian Rogers (brian-rogers) wrote :

The sound latency in Flash can be worked around by running
export PULSE_LATENCY_MSEC=20
before starting Firefox.

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

I ran that export command from a terminal before starting Firefox, but it didn't seem to have any effect. I tried the game I mentioned in message #25.

Revision history for this message
Brian Rogers (brian-rogers) wrote :

Did you start Firefox from that same terminal (just type 'firefox')?

Otherwise the variable won't actually be set for Firefox.

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

Ahh ok, I thought that variable would be applied system-wide, so I started Firefox from the top panel.
Running Firefox from the same terminal as the export command solves the sound issue; thanks for the tip!

Two more questions:
1) Why the value 20?
2) Wouldn't this be a sensible setting to include in the default configuration of Ubuntu?

Revision history for this message
Daniel T Chen (crimsun) wrote :

@Jordy The value that "best" works for each configuration really depends on the audio hardware, so it's very specific to a class of controllers/codecs. Certainly we can look at modifying it, but you should probably file a new bug against pulse and attach a verbose log (https://wiki.ubuntu.com/PulseAudio/Log).

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

Is there some sort of configuration file I can add that export command to, so Firefox always starts with that setting? Or should I just create an executable script?

Revision history for this message
Brian Rogers (brian-rogers) wrote :

What you can do is create a script that sets the variable, then launches Firefox.

Just run 'sudo gedit /usr/local/bin/firefox'. Then paste the following into the file and save:

#!/bin/bash
export PULSE_LATENCY_MSEC=20
exec /usr/bin/firefox "$@"

Then run 'sudo chmod a+x /usr/local/bin/firefox'.

This will intercept launches of firefox and set the environment variable first.

Revision history for this message
Psy[H[] (vovik-wfa) wrote :

Maverick, current updates:
"vavoom chaingun test" is still miserably failed by pulseaudio.
zynaddubfx launched with padsp produces something that remotely resembles cough.
latency is a bit smaller, but still clearly audible, around ~0.15s

Revision history for this message
Jordy van Heeswijk (jordyvh) wrote :

I've been trying to use the fix from comment #34 in 11.10 (Unity), this far without success.

I copied firefox.desktop from /usr/share/applications to ~/.local/share/spplications and modified it there so that it executes /usr/local/bin/firefox

For the rest I followed the steps from comment #34.

However, when I click the Firefox button in the Launcher (or whatever that taskbar is called in Unity), nothing happens.

When I run the command 'firefox' in a terminal, I see why: I get the message 'permission denied'.
When I run 'sudo firefox' all seems to go well, but I'm not too comfortable running the browser with administrator privileges.

What is the best way to apply this workaround in Unity?

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for reporting this bug to Ubuntu.
Ubuntu 11.10 (oneiric) reached end-of-life on May 9, 2013.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

Please upgrade to the latest version and re-test.

Changed in pulseaudio (Ubuntu):
status: Fix Committed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for pulseaudio (Ubuntu) because there has been no activity for 60 days.]

Changed in pulseaudio (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers