VMware
1 2 Previous Next 25 Replies Last post: Nov 5, 2009 4:47 PM by ritterwolf  

VMWare PulseAudio HOWTO posted: Aug 17, 2008 6:21 PM

Click to view ritterwolf's profile Enthusiast 53 posts since
Jul 23, 2006
Disclaimer: I accept no resposnsibility for any horrible things that happen to you, your computer, and those around you as a result of you following this HOWTO. It may cause you, or those around you, to get fired, kill your dog, insult your mother or make your computer explode and various other things that you might have thought impossible. You follow these instruction at your own risk.

I did this with Workstation 6.5 RC1 build 110068 on Ubuntu 8.04 64-bit.

With that out of the way, the instructions

1. shut down all your virtual machines
2. remove OSS emulation from ALSA, by adding the following lines to the bottom of /etc/modprobe.d/blacklist-oss

blacklist snd_pcm_oss
blacklist snd_mixer_oss
blacklist snd_seq_oss

3. unload those modules

$ sudo modprobe -r snd_pcm_oss
$ sudo modprobe -r snd_mixer_oss
$ sudo modprobe -r snd_seq_oss

4. we move the real vmware-vmx executable aside, and create a wrapper script

$ cd /usr/lib/vmware/bin
$ sudo mv vmware-vmx vmware-vmx.real
$ sudo touch vmware-vmx

edit this new vmware-vmx file in your favorite text editor, remembering to start is as root, eg 'sudo vim vmware-vmx'
        • start: vmware-vmx ----
#!/bin/bash

padsp $0.real "$@"
        • end: vmware-vmx ----

5. Now to set the required permissions on the wrapper script.

$ sudo chmod a+x,u+s vmware-vmx

6. Now to set the permissions on the library used to send OSS calls to PulseAudio.

$ sudo chmod u+s /usr/lib/libpulsedsp.so

That's it!

I tested this by playing music out of rhythmbox, and logging into a Windows XP guest. When I heard that dreaded login sound, I knew it was all working.

If you get stuttering sound, do the following:

$ sudo adduser $USER pulse-access
$ sudo adduser $USER pulse-rt

and add the following lines to $HOME/.pulse/daemon.conf

        • start: daemon.conf
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
default-fragments = 8
default-fragment-size-msec = 5
resample-method = speex-float-3
        • end: daemon.conf

restart the daemon, and stuttering should be better. Try tuning the values in daemon.conf if there is still stuttering.

Re: VMWare PulseAudio HOWTO

1. Oct 9, 2008 7:53 AM in response to: ritterwolf
Click to view sseremeth's profile Novice 5 posts since
Jan 10, 2006
Anyone get this working with vmplayer (on Ubuntu Hardy)? I'm having no luck.

Re: VMWare PulseAudio HOWTO

2. Nov 4, 2008 4:59 AM in response to: ritterwolf
Click to view dowhurst's profile Lurker 1 posts since
Nov 4, 2008

I did this with VMware 6.5.0 and Ubuntu 8.0.4.1 32bit exactly as described yet do not get sound. The guest WinXP is set to autodetect sound. No sound is detected. Pulsed is running so I've obviously got some difference going on here. 32 bit vs 64 bit should not make a difference based on your procedure. Not sure why padsp didn't provide the answer.

Thanks for your procedure though! It is a start.

Dow

Re: VMWare PulseAudio HOWTO

4. Nov 8, 2008 10:46 PM in response to: dowhurst
Click to view HNH90's profile Lurker 1 posts since
May 24, 2007
Hi,

I think that you should set the sound card "/dev/dsp" manually on your virtual machine settings.
VMware WS can't detect the sound card after unloading the modules "snd_oss_*" because "/dev/dsp" is automatically deleted when these modules are unloaded on recent Linux distributions.

I got sound with VMware WS 6.5.0 and PulseAudio 0.9.8 in Fedora 8 on 32bit box after changing the setting to "/dev/dsp".
(I didn't get sound with "Auto Detect". )

Re: VMWare PulseAudio HOWTO

5. Nov 10, 2008 6:45 PM in response to: ritterwolf
Click to view Aaron44126's profile Novice 27 posts since
Dec 20, 2005

Any other suggestions to fix the stuttering?

I got VMware working with PulseAudio using the information here with no trouble, but audio coming from guests makes a terrible stuttering sound. I tried adding the recommended stuff to daemon.conf and even changing the values but it doesn't seem to make any difference. :-P

I still prefer the stuttering to VMware complaining that the audio device is in use all the time, so thanks for this info!

Re: VMWare PulseAudio HOWTO

6. Feb 2, 2009 12:37 AM in response to: HNH90
Click to view kdart's profile Lurker 1 posts since
Nov 2, 2008
Just change the sound device to "/dev/dsp" in sound device settings.

THIS is all it took for me to finally get sound working in the guest OS. I dind't even you you could edit that field in settings. Thanks.

Re: VMWare PulseAudio HOWTO

7. Apr 7, 2009 2:44 PM in response to: Aaron44126
Click to view Mulchman's profile Novice 11 posts since
Apr 7, 2009
Aaron44126 wrote:
Any other suggestions to fix the stuttering?

I got VMware working with PulseAudio using the information here with no trouble, but audio coming from guests makes a terrible stuttering sound. I tried adding the recommended stuff to daemon.conf and even changing the values but it doesn't seem to make any difference. :-P

I still prefer the stuttering to VMware complaining that the audio device is in use all the time, so thanks for this info!

I too could use some suggestions to fix the stuttering. Even after making changes to daemon.conf enabling real time scheduling and high priority (and making the subsequent changes to the system limits file so the group pulse-rt can actually run pulseaudio at those levels) there is still stuttering. I've tweaked lots of settings and keeping default-fragments & default-fragment-size-msec to low values (like 4 each) makes it sound the best but there is still stuttering and skipping and pulseaudio seems a lot less stable running with high priority and real time scheduling.

My host OS is Ubuntu 8.10 (64 bit) and these are the additions I made to /etc/security/limits.conf for pulseaudio (and make sure the user pulseaudio runs as is in the pulse-rt group):
@pulse-rt - rtprio 99
@pulse-rt - nice -20

Anyway, a native option to route all sound through PulseAudio - like what VirtualBox does - would be a godsend.

Re: VMWare PulseAudio HOWTO

8. Apr 30, 2009 8:52 AM in response to: Mulchman
Click to view Mulchman's profile Novice 11 posts since
Apr 7, 2009
I'm having really good success - much better than before - with Ubuntu 9.04 (64 bit), VMware Workstation 6.5.2 (build-156735), Luke Yelavich's PPA (brings PulseAudio up to 0.9.15), and wrapping vmware-vmx with libaoss.so (instead of padsp).


With this setup I'm finally able to have sound in both the Host Ubuntu OS and (non-choppy & non-stuttering sound) in a Windows XP Professional (32 bit) virtual machine. Your mileage may very (YMMV) depending on your hardware and what not...

Re: VMWare PulseAudio HOWTO

9. May 31, 2009 10:07 AM in response to: Mulchman
Click to view bobdevis's profile Novice 6 posts since
Jan 23, 2009
I tried a lot of stuff but ended up using the surefire permanent way of fixing this by adding an extra soundcard. If you have free PCI/PCIe slots I can reccomend this solution as you do not have to upset your distro sound settings to pull this off.
Appart from needing extra hardware the only inconvinience is that you can not control the volume of your guest with any tool on the host. Just change the volume settings inside the guest!

You need one extra soundcard and one male-male audio cable to connect the output (green) of soundcard A with the line-in (blue) of soundcard B. Use the output of soundcard B for your speakers/headphones.
Once your 2nd audio card is installed, you should have a /dev/dsp and a /dev/dsp1 device or something like that. If you do NOT have 2 dsp devices, your host does not see the 2nd soundcard correctly and there may be a driver issue.

Install "pavucontrol", the Pulseaudio management tool.
In Pavucontrol mute the output device (audio card) that you would like to use for VMWare. What device name corresponds to what dsp device is something you may have to establish expermentally.
If some applications stop making sound now, it means you have to kick their playback stream to the other output device in Pavucontrol.

Now you have one /dev/dsp* device (the one you muted with Pavucontrol) that will not be touched by Pulseaudio. Point VMWare to that device and you are all done!

Re: VMWare PulseAudio HOWTO

10. Jun 4, 2009 3:16 PM in response to: ritterwolf
Click to view fermulator's profile Lurker 2 posts since
Jun 4, 2009
I've tried the above instructions on:

  • Ubuntu Jaunty 9.04 Desktop (2.6.28-11-server)
  • vmware 2.01 (VMware-server-2.0.1-156745.i386)

And I still receive the error: Failed to open sound device /dev/dsp: Connection refused Virtual device sound will start disconnected.

A couple of notes:

  • In Jaunty (latest released Ubuntu as of this date), all of the oss modules are already removed from the system. So blacklisting wasn't required.
  • Wrapping vmware-vmx with padsp makes a lot of sense (although most applications don't require this), it still didn't help to enable sound with vmware
  • The notion of editing "$HOME/.pulse/daemon.conf" is a good idea, but doesn't the vmware-vmx process run as root? So configuring pulse settings for our currently running $USER doesn't make much sense does it? (I could be wrong here though)

What now?

This problem with VMware and PulseAudio is littered all over the Internet. It would be really nice to find a solution that works 100%. (I remember trying this solutionon a previous version of Ubuntu, Hardy I believe, and it worked great!)

To elaborate: I'm very interested in a PROPER solution. Uninstalling PulseAudio, forcing VMware to use OSS, or anything like that isn't really the "right" solution. PulseAudio is a nice audio server, and I'm very much interested to hear if/how people have got VMWare to run with PulseAudio (AND without the stuttering audio problem). crosses fingers !

Re: VMWare PulseAudio HOWTO

11. Jun 6, 2009 5:30 PM in response to: fermulator
Click to view bobdevis's profile Novice 6 posts since
Jan 23, 2009
fermulator,
Do you refer with the "above instructions" to my 2nd soundcard solution or to the original post?
In case you are referring to mine, here is something you can try;

After your 2nd soundcard is propperly installed, the loopback cabe is in place, do the following;

Make sure pavucontrol is not running
Make sure nothing is making any sound.
Now give the "killall pulseaudio" command in the console.
Start VMWare, start a vm (with its sound output pointed to a dsp device) and let the vm make some sound (*let it play an mp3 or so). You should hear it just fine now.
Now while the mp3 is playing, start pulseaudio again in the console.
Pulseaudio will now fail to hook up to the soundcard that is used by the vm, and will use the other one instead exclusively. This is what you want.
With the soundcard that you are reserving for VMWare muted in pavucontrol AND with pulseaudio failing to hook up to it once, pulseaudio will surely leave that card alone. Also after rebooting.

Re: VMWare PulseAudio HOWTO

12. Jun 12, 2009 12:32 PM in response to: bobdevis
Click to view sile's profile Lurker 2 posts since
Jul 11, 2007

Original post method worked for me:

Jaunty 9.04 x64 (Dell D620)

VMWare 6.5.2

I changed /etc/pulse/daemon.conf to:

high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
default-fragments = 4
default-fragment-size-msec = 4
resample-method = speex-float-3


Re: VMWare PulseAudio HOWTO

13. Jun 18, 2009 11:39 AM in response to: sile
Click to view RDaly's profile Lurker 1 posts since
Oct 3, 2008

I tried using the padsp method... It worked once, but then VMware started complaining 'cause /dev/dsp was no longer present on the system (modprobe -r removed the device nodes).

I also tried using the LD_PRELOAD, but that just isn't working. The sound adapter won't even connect (I get the little red X over the device on guest startup).

VMware - please fix.

Re: VMWare PulseAudio HOWTO

14. Jul 29, 2009 5:22 AM in response to: RDaly
Click to view raywood's profile Enthusiast 32 posts since
Aug 6, 2007
Has there been a clear solution to the problem of stuttering audio yet? I am using WinXP in a VMware Workstation 6.5.2. VM on Ubuntu 9.04 (Jaunty). I have tried a number of suggestions. A couple of them seemed to work for a day or so, but then the problem returned. This seems, so far, to be one of those situations where what works for one person does not work for another, and vice versa, possibly because of some larger underlying issue.

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities