Wednesday, August 12, 2009

Audio Fix for SuSE 11.1 and VMware

We are now doing regular meetings on a collaboration site on Windows, so I need audio. I run Windows when necessary in a sandbox (VMware: http://www.vmware.com/). I was able to hear myself speaking in the headset earphone, I was able to hear a "presence", but could not hear other participants and they could not hear me.

It turns out that VMware runs the OSS (Open Sound System) instead of ALSA (Advanced Linux Sound Architecture). The solution to the hearing problem is to patch the basic VMware script to preload an ALSA-OSS wrapper. The solution to the recording problem was to access the Capture module of the sound system and turn it on.

Details
Player Sound
Initially there was no sound, so I went to the Linux audio control (KMix) and found the first control ("Front") muted. Unmuting it now gives a presence, but no apparent control of volume. I tried starting Amarok. It played, but no sound. I then ran

yast2 sound &

in a root terminal to check the settings. The presence disappeared when YaST started up. I reset all the values, restarted the sound system, restarted KMix, then checked it to find the first control ("Front") muted again. Unmuting it restored the presence. Restarted Amarok, now we have sound on Linux.

Now I started VMware as user. It reports:

Failed to open sound device /dev/dsp: Device or resource busy.
Failed to connect virtual device sound.

The link

http://symbolik.wordpress.com/2007/11/10/vmware-server-104-and-kernel-26231-on-gutsy/

says that VMware uses OSS, not ALSA. I checked for the existence of all the requisite files following that link. They all exist, so VMware is just not loading them.

http://ubuntuforums.org/showthread.php?t=331175

recommends patching the basic VMware script. Issshhhh (large sucking through the teeth sound...)

Before taking the plunge of patching the basic vmware script I ran yast2 sound to make sure it is using the cited device /dev/dsp. YaST doesn't say, but I turned on pulse audio, brought up Amarok and the mixer to check things. Amarok was already up in the system tray, so I shut it down completely and ran VMware one more time.

No change, no sound, no connection to the dsp. So bit the bullet:

cp /usr/bin/vmware /usr/bin/vmware.orig
kate /usr/bin/vmware

I added the following comments and command at the start of the script:

# 090811 patch to use alsa sound vice oss
LD_PRELOAD=libaoss.so exec

# the remainder of the original script

Then saved it and ran

chmod +x /usr/bin/vmware

just to be safe. I then restarted VMware normally as user.

No joy.

I tried starting VMware with the sound card disabled and then activating it after vmware was up and running. No joy.

So shutdown and rebooted the entire system, then restarted VMware without touching any audio apps and making sure that no audio apps were running.

Now it loads!!! WE HAVE SOUND!!! And VMware finds the device and Windows now has player sound.

But no record sound.

Record Sound

The microphone connection is working: I can hear the microphone in the earphone and muting the mike in KMix makes that go away. But KRecord does not record any sound.

First step: Google:

http://forums.opensuse.org/hardware/402106-no-sound-new-suse-11-1-a.html

says to try the following to test speakers:

speaker-test -c2 -l5 -twav

This gives five renditions of "Front left" although zero renditions of "Front right" or anything else.


arecord -d 10 myrecording.wav

gives a ten second recording of... nothing. :-(

/usr/sbin/alsa-info.sh


does a number of tests on the sound system and saves the results in /tmp/alsa-info.txt.
It cites
E-sound daemon: Running - No.

and then a raft of other details, including:

Simple mixer control 'Capture',0
Capabilities: cvolume cswitch
Capture channels: Front Left - Front Right
Limits: Capture 0 - 46
Front Left: Capture 45 [98%] [28.00dB] [off]
Front Right: Capture 45 [98%] [28.00dB] [off]

This implies that KMix should have a module for capture and that it is presently muted.

I added the Capture channel (KMix > Menu > Settings > Configure Channels) and checked its checkbox.

Then tested with KRecord. It works!!!

Now, try on VMware. It works too!

I love it when a thing works out right...

1 comment:

Unknown said...

Hello
many thanks for this tip, my VMWARE Server VMs did not produce any sound any more without any reason. Thanks to your tip (patching the VMWARE script) they are now working again. Many thanks
Philippe