Simultaneous sound on guest and host?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
thesun
Posts: 26
Joined: 16. Aug 2009, 01:21
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: WinXP, Vista

Simultaneous sound on guest and host?

Post by thesun »

I am hoping someone knows what I'm doing wrong. I have working sound in both the host and the guest, but not simultaneously. If the guest is working, the host sound is gone until I kill the guest.

I arrived at this from having no sound on anything as soon as the guest started via a series of tweaks, each solving pieces bit by bit. I am running a WinXP guest via VirtualBox on Fedora 8 host and initially found that I had no sound whatsoever in either guest or host. After following some threads and tutorials I found that I could get sound in the guest...but sound on the host was gone -- even after I had killed the guest. Only logging out and relogging into X returned sound to the host. Lastly, I "chmod"ed 777 to both /dev/dsp and /dev/mixer and that final step gives me nice sound in the guest when it's running or in the host when VB stops...but I'd ideally like to be working in MS Office and still be able to use Skype or watch bookmarked stuff on YouTube in Linux.

Anyone out there have simultaneous sound in both the guest and the host? Or am I stuck at this point, trying to do the impossible? :-) I'm amazed that it was this easy to get this far configuring VB...astonished to see Windows apps running just fine within Linux (how many years have we been waiting!!!). But I'd like the VB to be more like any other app...hopefully I don't have to close XP each time my Skype phone rings.

Thanks for any and all tips!
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: Simultaneous sound on guest and host?

Post by stefan.becker »

You must use Pulse, this a Sound Server, not a Hardware Device.

Try installing Pulse on the Host or use a newer Distribution.
fyi
Posts: 25
Joined: 20. Jan 2009, 07:58
Primary OS: Debian Lenny
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP sp3, Debian, others

Re: Simultaneous sound on guest and host?

Post by fyi »

I'm getting very poor mic input latency only through pulse in 3.0.4 with respective guest additions. I've tried upgrading pulse and alsa-pulse to the bleedin edge too. The guest is xp pro sp3 with the windows standard integrated audio driver.

Using ALSA on it's own with a vbox guest is ok (latency wise), but i really do need the ability to patch and mix inputs and outputs at super low latencies =) Jack fits that bill perfectly. Pulse only extends ALSA's short-falling IMHO, maybe the Pulse->VBOX interface is very well tuned yet.

JACK is undoubtedly the real-time professional audio standard as far as I'm concerned, it would be great if more and more application developers and distros understood and made JACK support available.

Unfortunately Jack (on my host) doesn't appear in the guest audio settings dropdown in vbox, even after reinstalling vbox and recompiling the vbox kernel modules.

Any ideas how to configure vbox up with Jack?
Vbox is JACKified, right?
Sony Vaio SZ79SN/C, 2.6.31.12-rt21, VTx. Core2Duo T9300 2 x 2.50GHz, 800MHz FSB, 6MB L2, GM965, NVIDIA 8400M GS / X3100, 4GB DDR2 667, Seagate GForce, 13.3 WXGA TFT White LED, Intel 4965AGN, 1.76kg
thesun
Posts: 26
Joined: 16. Aug 2009, 01:21
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: WinXP, Vista

Re: Simultaneous sound on guest and host?

Post by thesun »

I believe I am already using Pulseaudio as my primary Linux sound server, but I am not sure what settings I would need to change. Are there any command line or GUI apps that will allow me to adjust and modify the Pulseaudio server so that it all works? What needs to be changed or checked in order to start to figure this out?
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: Simultaneous sound on guest and host?

Post by stefan.becker »

There is nothing to choose instead of Pulse in the VBOX Guest Settings.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Simultaneous sound on guest and host?

Post by Sasquatch »

For the best test, open your media player and configure it to use the default ALSA device. Don't pick the hardware itself, use ALSA or Default as option. Now play a file. Open a second instance of the media player or pick a different one that can do the same. Play a song or video there too. If you get mixed audio, you're having some other issues with your sound. I've read quite a few posts, not only here, that mention Skype as a problem application, taking full control of the sound card. This prevents other applications to send audio through ALSA to the sound card. If even flash in your browser causes this behaviour, you're missing a vital package, ALSA-OSS or similar that will make the audio for OSS apps go through ALSA (skype and flash use OSS).

So, check some Linux guides on audio settings and configuration, then come back here. Your problem does not have anything to do with VB.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
thesun
Posts: 26
Joined: 16. Aug 2009, 01:21
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: WinXP, Vista

Re: Simultaneous sound on guest and host?

Post by thesun »

I think there are two threads here. Not sure if the moderator reply is directed at the original thread or the one immediately above. In my case, I'm having no issues with sound in Linux (Fedora 8 ) whatsoever. YouTube is fine, xine, mplayer, Skype, RoseGarden with Jack, etc., and while certain files "lock" the audio that's released immediately after the program finishes. (For example, Skype won't let me make an outgoing call when I'm watching a YouTube video...but the second that YouTube is done and the page is elsewhere, I'm fine.)

However, ONLY when I'm using VirtualBox does everything lock up, and ONLY VirtualBox seems to lock my audio server. Thus, I'm assuming that the VB on Linux Hosts will be a better place to find folks who might have a similar issue. I doubt that there is any quantity of VB users on FedoraForum, for example, and since my sound is flawless in every other application, I doubt that the general Linux user with good sound will have an idea of what's going on.

Are there a number of other people out there in VBworld who are running Linux and have simultaneous use of both the within VB Windows sound as well as the Linux Host sound? Does anyone out there use Fedora 8 and have this working? Do folks out there running Fedora 10 or 11 have simultaneous Guest and Host sound? I'm a little loathe to upgrade, reinstalling a number of relatively finicky programs that took days or weeks to get right, just to find out I have the same issue in Fedora 10...or that I'm asking for the impossible: that (just as, apparently, Skype doesn't work within an XP Guest?) having sound isn't reasonable given the current limitations.

Again, thanks for the help and suggestions.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Simultaneous sound on guest and host?

Post by Sasquatch »

thesun wrote:while certain files "lock" the audio that's released immediately after the program finishes. (For example, Skype won't let me make an outgoing call when I'm watching a YouTube video...but the second that YouTube is done and the page is elsewhere, I'm fine.)
That's exactly what I'm talking about. This isn't normal, you're missing something on your system. A package, settings, something that prevents audio mixing.
thesun wrote:However, ONLY when I'm using VirtualBox does everything lock up, and ONLY VirtualBox seems to lock my audio server.
Really? Then why does Skype or 'YouTube' lock the sound card too? VB 'locks' it because it can play audio at any given moment. The 'lock' you're talking about is for applications that want full control of the hardware itself, instead of using the sound server. In Linux, a sound server is used just for this, simultaneous output of audio applications.
thesun wrote:Are there a number of other people out there in VBworld who are running Linux and have simultaneous use of both the within VB Windows sound as well as the Linux Host sound?
I know exactly what I'm talking about, because, as you can see in my profile, I use Linux (though it's Ubuntu, the same problem can apply). When I ran Linux the first time two years ago, I had the same problem. As soon as I started my audio player for music, flash on websites like YouTube didn't play any sound and when I stopped the player, restarted the flash movie I got sound in that. However, as soon as I wanted to play music, the player barfed an error stating it couldn't open the hardware because it was locked by another process. It took me quite some time before I noticed my mistake.
Now I run ALSA on my laptop and PulseAudio on my PC, both can play music while VB is running and I can hear the sound from my VMs too. So to repeat myself, I don't think it's a VB problem alone. You have to check your own system for missing packages or reconfigure your applications. Flash 10 should be able to use ALSA now, so that's no longer a problem. Skype however probably still uses OSS, or demands full control of the hardware. The latter is bad practice on any system, it isn't supposed to demand that, yet they do. To get it to run through ALSA, install the alsa-oss package and start Skype with aoss skype. That will wrap all OSS calls through ALSA, allowing you to use audio mixing.
If this doesn't work, check your distro forum, I'm very sure that others have the same problem, though maybe not with VB but with another program.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
thesun
Posts: 26
Joined: 16. Aug 2009, 01:21
Primary OS: Fedora other
VBox Version: OSE Fedora
Guest OSses: WinXP, Vista

Re: Simultaneous sound on guest and host?

Post by thesun »

I appreciate the clearer response...I am not enough of an audiophile to care about running different audio simultaneously most of the time. I wasn't trying to say that you didn't know what you are talking about. But _I_ didn't know what you were talking about, so I am glad you took the time to explain more specifically what you meant.

Am I understanding you correctly that I should be able to run Skype AND a YouTube video...and perhaps my mp3 player application all at the same time? Won't that mean that I get a garbled mix of 3 things which is impossible to listen to?

In my case, I really don't _need_ to do the above. If I want an mp3 player I can listen to that and then shut it off when I want to make a Skype call. I'm mainly concerned that if I want to use an application, it _works_. Maybe my system is missing something, but I'm a bit worried about reconfiguring everything like that just for this one application...VB. If that's the only way to do it (essentially it sounds like what I'm currently doing is using a kind of "work around" and what's really supposed to happen is everything should be simultaneous...) then I can start along that road. I will definitely try installing the alsa-oss package you mention. Are there others to check? Is there a command line that will list my installed sound-related packages so I can check and see which important ones might be missing?

Thanks very much. I definitely did not intend to imply that you didn't know what you were talking about...I just didn't know which part of the post you were addressing, nor whether your reply was intended to solve my issue or the person with crappy sound.

I guess the real reason that I'm loathe to totally scrap what I've got right now is that it took a long time to get all the various programs working (especially Rosegarden, which requires Jack as its sound server) and I don't use Windoze much. It may simply be easiest to logout and log back in again on those rare occasions when I use VB and it borks the sound. At some point in the nearish future I'll be upgrading Fedora, so I may want to just wait until I do that to worry about getting it to work right.

If there are any other packages to check or settings you think might be a quick fix, that would be great. I tried enabling the "share sound" options in the KDE control, but that didn't seem to change anything. I suppose I should boot into Gnome and see if I'm in the same boat. Sometimes that makes a difference. But I'm the first person to admit that I don't know much about sound, sound servers, or what's going on beneath the hood. I'm just happy if I have clear sound that's "working" as far as my end-user experience goes. If it's not optimal that's okay.

Do you know how to restart the sound server or "unlock" it once VB causes it to hang? Might I perhaps just run a quick "/sbin/service xyzsoundservice restart" and save myself the relogging in hassle? In my case, that would be ideal...I don't mind the minor inconvenience of a service restart. It might be easier than spending weeks getting the various other things to work.

Again, thank you very much for taking the time to offer some suggestions and explain more clearly what you meant. I will try some of the things you mention and if anyone has other suggestions I'd love to hear them. Thanks!
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Simultaneous sound on guest and host?

Post by Sasquatch »

The fastest fix there is for you, is change the VM settings to either disable sound, or put the sound output to NULL (doing essentially the same). That way, you won't hear any sounds from the VM and the sound card won't get locked either.

Running service <soundserver> restart is something you can try. KDE uses aRTS by default, Gnome uses ESD/PulseAudio. I personally use Xfce, which uses just what you install, and by default ALSA, where it ends up anyway.

I recommend that you read up to the Linux sound system, how things work, what settings are needed etc. I've done only a small part of it and know enough to get multiple sounds working, just like how it works on Windows and Mac. Give it some thought: you can listen to your music, while you can hear the sound of new email or someone said something on your IM. Currently, that isn't possible for you on your system. I find it one of the most basic things an OS needs to be able to do, output sounds from multiple sources without issues.

So, when you are ready to upgrade your system to the latest version of Fedora, take some time to get your sound figured out and working as it should. This can take a day, maybe two. When I do an upgrade, I usually do a clean install (yes, that means twice a year, as that's the release cycle of Ubuntu). I've only done an upgrade once and even though it went fine, I didn't like the end result in my package manager. A lot of packages were 'local or obsolete'. Anyway, it's your choice.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply