18

I use PulseAudio to send sound over the LAN to an audio server.

When playing any Flash media in Firefox or Chrome, the sound flutters (example), as if the volume were going up and down every second.

I have discovered that I can stop the sound fluttering if I follow these steps:

  • Start a Flash video, such as a video on YouTube

  • Run pulseaudio --kill on the server

  • Wait about 7 seconds

After this, the PulseAudio server automatically respawns, and the sound in the Flash video is fine.

The problem is that I have to do this every time I start a Flash video. This is obviously not desireable.

How do I make whatever it is that makes the sound work when I go through these steps stick so that I don't have to do them?

I doubt that someone will come up with an immediate and simple fix (though that would be nice), so the bounty could go to anyone who provides at least a method of diagonosing the problem.


Details

Here are my sound device output settings. As far as I can tell, all four devices point to the exact same physical device.

sound settings

PulseAudio log output, taken while attempting to play a Flash video.

I've tried to get logging details from Flash, but despite installing and enabling Flash for debugging, it has not generated any ouput at all.

The problem does not exhibit with any other software, so I am reasonably certain it's specific to how Flash interacts with my sound set up.

Here is some error output that might be helpful:

$ cat /var/log/syslog | grep pulseaudio
Jul 30 01:40:08 mythbuntu pulseaudio[17388]: [pulseaudio] module.c: Failed to open module "module-esound-protocol-tcp": file not found
Jul 30 01:40:08 mythbuntu pulseaudio[17388]: [pulseaudio] module-gconf.c: pa_module_load() failed
Jul 30 01:40:08 mythbuntu pulseaudio[17388]: [pulseaudio] module.c: module-combine is deprecated: Please use module-combine-sink instead of module-combine!
Jul 30 01:40:08 mythbuntu pulseaudio[17388]: [pulseaudio] module-combine.c: We will now load module-combine-sink. Please make sure to remove module-combine from your configuration.
Jul 30 01:55:07 mythbuntu pulseaudio[17406]: [pulseaudio] module.c: Failed to open module "module-esound-protocol-tcp": file not found
Jul 30 01:55:07 mythbuntu pulseaudio[17406]: [pulseaudio] module-gconf.c: pa_module_load() failed
Jul 30 01:55:07 mythbuntu pulseaudio[17406]: [pulseaudio] module.c: module-combine is deprecated: Please use module-combine-sink instead of module-combine!
Jul 30 01:55:07 mythbuntu pulseaudio[17406]: [pulseaudio] module-combine.c: We will now load module-combine-sink. Please make sure to remove module-combine from your configuration.
Jul 30 02:04:43 mythbuntu pulseaudio[17433]: [pulseaudio] module.c: Failed to open module "module-esound-protocol-tcp": file not found
Jul 30 02:04:43 mythbuntu pulseaudio[17433]: [pulseaudio] module-gconf.c: pa_module_load() failed
Jul 30 02:04:43 mythbuntu pulseaudio[17433]: [pulseaudio] module.c: module-combine is deprecated: Please use module-combine-sink instead of module-combine!
Jul 30 02:04:43 mythbuntu pulseaudio[17433]: [pulseaudio] module-combine.c: We will now load module-combine-sink. Please make sure to remove module-combine from your configuration.

Here is the output from pactl list from the server (computer with speakers).

Here is the output from pactl list from the client.

6
  • What kind of network connection is between the source/sink?
    – ish
    Jul 30, 2012 at 7:57
  • @izx: I do not know what you mean by "source/sink". If that is another way of saying "server/client", then it's an ethernet LAN connection. If it's something else, you'll have to explain what you mean.
    – Questioner
    Jul 30, 2012 at 10:40
  • Dave, can you join the chat room? I think I probably have a solution but need to talk...
    – ish
    Jul 30, 2012 at 10:44
  • If not, I just meant wired or wireless and some details, e.g. wired=100 MBps router, etc. or wireless = 802.11G, N, etc.
    – ish
    Jul 30, 2012 at 10:47
  • @izx: Oh, I see. It's a wired LAN with a router between them. I believe it's 100MBps. I think the client is capable of 1GBps, but the server LAN card is still 100GBps. If that's important and there's a command I can run to get an exact speed, please let me know.
    – Questioner
    Jul 30, 2012 at 12:02

9 Answers 9

10
+200

Preface

I was able to replicate Dave's issue in experiments, and they lead me to believe that Flash is somehow sending the sound to PulseAudio in such a way that it creates a lot of network traffic (think lots of tiny packets, not bandwidth); this overwhelms the network "tunnel" PulseAudio has created, i.e. you have

Youtube => [PA-client => network => PA-server] => speakers

I could solve the issue by putting both the client and server on their own virtual network, giving them effectively infinitely fast connectivity (10 Gbits/sec) between them; obviously, that doesn't work for real-world networks :)

So, a bit of googling and this post and this one gave me the idea of dropping the tunnel (middleman, as Dave aptly put it), and having the client talk directly to the server, i.e.

Youtube => network => PA-server => speakers

And that worked for me; Flash videos/sound play flawlessly.

Let's try it!

This assumes your client-server are on a local network (router, etc.)

  1. Preliminary: On the client machine, if you have an existing setup, open paprefs and uncheck everything; then kill PulseAudio to be sure.

  2. On the server machine (i.e., the one with the speakers), start PA Preferences (paprefs) and set it up as follows:

    enter image description here enter image description here enter image description here enter image description here

    • Then close it, and kill PulseAudio in a terminal as shown, wait, and check that it is now listening on port 4713:

    enter image description here

    • If you don't see it, open paprefs again and check the remaining boxes in the Network Access and Network Server tabs (they don't hurt)

    • Make sure you know the server's IP address - use ifconfig, etc. We'll use 192.168.0.4 in our example.

  3. On the client machine, open a terminal, and test our direct connection first, with a speech sample WAV (replace 192.168... with your server IP!)

    wget http://www.signalogic.com/melp/EngSamples/Orig/female.wav
    paplay --server=192.168.0.4:4713 female.wav
    
    • Abort with Ctrl-C if it works, it can get boring ;)

Now, close all running browser instances, and then start it (assuming Firefox here with the following syntax):

PULSE_SERVER=192.168.0.4:4713 firefox &
  • Replace 192... with the appropriate IP for your server!

  • In that Firefox instance, open up Youtube (or whichever Flash video site), and try playing videos back --- fingers crossed, it should work without stuttering/pausing!

Make it stick

If you want to make this fix apply to all programs instead of having to put PULSE_SERVER=192.168.0.4:4713 in front of every command, edit /etc/environment on the client and add PULSE_SERVER=192.168.0.4:4713 on a new line at the end of the file. Also add a line break at the end.

This will make all sound on the client go to the Pulseaudio server, so be sure that's what you want before making this edit to your /etc/environment file.

Reboot, and enjoy a smooooooth audio experience. ;)

7
  • Any firewalls in the way? and you put 192.168.0.4 everywhere, right? Try the firefox anyway even if female.wav didn't work...
    – ish
    Jul 30, 2012 at 13:56
  • Argh, I forgot one step -- please add this line to the end of /etc/pulse/system.pa on the client: load-module module-native-protocol-tcp auth-anonymous=1; save, kill pulseaudio, and try now.
    – ish
    Jul 30, 2012 at 14:05
  • Yes, the client -- the paprefs settings on the server should have enabled that already. You could additionally add it to the server too, won't hurt...
    – ish
    Jul 30, 2012 at 14:09
  • @DaveMG: Sorry, I assumed you would have uncommented those two lines on the client for now. So sorry, was busy for the last day or so and not on. I will be back on around 11:30 AM JST and we can resume. In the meanwhile, you may find these two videos of the default tunnel config I made interesting: stuttering, working
    – ish
    Aug 1, 2012 at 21:32
  • Just so you know, I edited the answer and I'm consolidating down the comments so it's a little more clear to anyone who might read this answer (that's why my comments are removed). I was just wondering if the load-module module-native-protocol-tcp auth-anonymous=1; line in /etc/pulse/system.pa should be included in the answer, or if it was a part of the diagnostic process that can be discarded?
    – Questioner
    Aug 7, 2012 at 6:51
3
+50

I think your problem might be related to the flash player.

There is a FireFox plugin Flash-Aid that installs appx flash version according to your environment.

1
  • Thanks for the tip. Downloaded it, installed it, tried a few different variations of Flash. Unfortunately, the sound pulsing problem persists.
    – Questioner
    Apr 26, 2012 at 19:24
3

If the problem is Gnash here is how to fix it:

Close all browsers and run these commands:

sudo apt-get purge gnash mozilla-plugin-gnash adobe-flashplugin

then this sudo apt-get install adobe-flashplugin

this fixed my problems: basically it removes everything related to Gnash and installs Flash.

2
  • tell me if it works
    – zeitue
    Apr 27, 2012 at 6:40
  • Thank you for the suggestions. As per my updated question, though, changing the Flash plug in does not seem to help the problem.
    – Questioner
    Apr 28, 2012 at 12:25
2

I was able to fix the video colour inversion problem by unchecking (disabling) the Enable hardware acceleration checkbox when you right click the flash player and click Settings (Refresh to see its effect).

I've got the same audio stuttering problems as you. It works initially, then after a while the stuttering kicks in. Hopefully someone can fix this - although I'm curious as to how you can bypass the pulse audio server to get sound (I'm just using a laptop without network audio needs).

(I have Flash 11.2 r202 on Firefox Kubuntu 12.04 amd64)

1
  • Thanks for the suggestion. I tried enabling and disabling hardware acceleration, but it does not seem to change anything for me. Also, I don't know what you mean by "bypass the pulse audio".
    – Questioner
    Jun 11, 2012 at 23:20
2

Do you have MIXX dj Player Installed ? It sometimes messes up with the sound server. Atleast if you install it it will change your default sound theme "ubuntu" to freedesktop.

You can try installing "PulseAudio Preferences" from Ubuntu software center.
There are some config options related to network.

0
1

I have the same problem and have not yet found a perfect solution to the problem. I have noticed some things that might help you:

1) It happens for me with flash, but also sometimes with the html5 version of youtube. Does this also happen for you? (http://www.youtube.com/html5/ you can enable html5 version of youtube here). This suggests that the problem is not exclusive to flash (but maybe somehow browsers?)

2) I can get the sound working properly like you without going to the server by using pavucontrol by setting the output device to the local device and then back to remote server. This solves the stuttering of audio and random pauses and skips of video. This alas only works until the next video starts.

3) I am pretty sure that while googling this problem I ran across some people saying that the problem was related to the clock counters of the client and the server not being linked up properly and that is what is reset by restarting server or reconnecting with the client (ie. point 2). I'll try to dig that out for you.

I couldn't find the promised discussion, but I did find some background information on the timer based scheduling: http://0pointer.de/blog/projects/pulse-glitch-free.html

4
  • +1 for letting me know I'm not alone in the universe! For point 1, I did try using the html5 version of YouTube while trying to solve this, but videos didn't play correctly, and in an entirely different way, so I felt it was kind of inconclusive (maybe it's a different problem). For point 2, that is interesting, and I will see if it works for me too. It does seem like a different workaround to the same problem. And point 3 is the most encouraging information, as it has the potential to start leading toward an actual explanation of the cause. Thanks for responding!
    – Questioner
    Jul 29, 2012 at 13:25
  • No problem. I looked for the information I was referring to, but I was unable to find it again. Jul 29, 2012 at 14:01
  • 1
    I posted a bug report to launchpad here: bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1030559 Let's see if this gives us some pointers. Jul 29, 2012 at 17:12
  • Nice. I posted a comment on the bug so hopefully I'll be notified of any updates. I hadn't posted my own bug report because I could never figure out how to use Apport in such a way as to be able to make a bug report when there was no particular software crash.
    – Questioner
    Jul 29, 2012 at 23:47
1

I'm really glad that I have found this page finally.

I've had this problem since many versions of Ubuntu (it started to get nasty when padevchooser was abandoned) and now with Arch. The solution to set & export the environment variable PULSE_SERVER before starting the browser has always worked good for me. It is not necessary to change anything on the server.

But there's one thing I do not understand: When I start my browser (Chromium) from a terminal inside the desktop environment, the sound works. When I start the browser from a launcher (Xfce, Gnome, ...) like it should be normally, the problems described above are there. I think that has got something to do with X11 environment variables, but this is beyond my skills.

For me I solved the problem now by editing my chromium.desktop file and adding the Pulse-Server there:

Exec=sh -c "PULSE_SERVER=mice.local chromium %U"

1

You need to have these plugins on firefox to flawlessly run any media. Check which one you have and which you have not.

The profile should be this:

0
0

I found a solution to fix stuttering while using module-tunnel-sink.

All you have to do is download Flash Player version 10.3 (which also have hardware acceleration support, Adobe dropped it in version 11).

Here's the x86_64 binary

To install it extract libflashplayer.so library to ~/.mozilla/plugins directory or change current link using update-alternatives.

Please be aware that 10.3 version have many security vulnerabilities, so you use it at your own risk.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .