Scratchy Audio in Vista Guest

Discussions about using Windows guests in VirtualBox.
Post Reply
slackcc
Posts: 2
Joined: 11. Dec 2008, 18:30

Scratchy Audio in Vista Guest

Post by slackcc »

Hi all,

I recently installed VirtualBox (v. 2.0.6) under LinuxMint (2.6.24-16-generic kernel) and I'm finding that audio playing from within the guest (Vista Ultimate) is very scratchy.

I'm running the VM on a separate physical disk drive and have 512MB RAM allocated. And I've tried all 3 audio adapter settings on the VB side, PulseAudio seems to be the worst and ALSA and OSS seem to be about equal.

Has anyone else run into this problem and found a solution?

Thanks,

Chris
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

If PulseAudio gives some response, that means that you run PulseAudio as sound server. Check the settings of it. By default (on Ubuntu, and Mint is Ubuntu), these settings are not optimal. You may need to increase the buffer size and amount of buffers to get better sound quality.
You can also decide to remove PulseAudio completely and stick to Alsa.
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.
slackcc
Posts: 2
Joined: 11. Dec 2008, 18:30

Post by slackcc »

That seems like the right direction to go in, it sounds like a buffering issue of some sort. Could you point me to where I might adjust the buffer sizes or give me an idea of how I might go about getting the pulse settings to be more optimal?

I've run Linux servers for years but audio doesn't frequently come up given the lack of sound cards and speakers and I think the last time I setup a Linux desktop system with audio running was around 1993, things have changed a bit since then :-) So I'm a bit out of my element in this one.

Thanks,

Chris
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Check the PulseAudio site. Should be www.pulseaudio.org but I'm not sure.
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.
mark_orion
Posts: 33
Joined: 4. Nov 2008, 17:16

Post by mark_orion »

I had similar problems with recording (microphone input) with pulse and an XP guest. XP recorded too slow and distorted. I could solve the problem by setting up ALSA to use pulseaudio by default. This can be done by entering
asoundconf set-pulseaudio
or by setting up an .asoundrc file in your homedirectory:

pcm.!default { type pulse }
ctl.!default { type pulse }
pcm.pulse { type pulse }
ctl.pulse { type pulse }

Now I can use the ALSA driver in Virtualbox and the output / input is still routed through pulseaudio.
tshann
Posts: 35
Joined: 18. Jan 2009, 22:23
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: WinXP
Location: Portland, OR USA

scratchy & Static sound in Win2K & XP guests (Ubuntu

Post by tshann »

I was having scratchy sound in these VM's using alsa. Then, I used the suggestion of mark_orion: asoundconf set-pulseaudio
After that, I set the VM to pulse, and rebooted the guest. Boom! the sound is crystal clear. So if there is a config file I can set that command in, I should have good sound in VM's from now on. Coolio!

Thanks for the suggestion mark, appreciate it. I'll probably look into the other suggestions and the config file he suggests (.asoundrc) and perhaps just put that single command in that config file. But for now, it's great to have non-scratchy sound. Awesome!
Peace
eha1990
Posts: 1
Joined: 14. Mar 2009, 13:28

Re: Scratchy Audio in Vista Guest

Post by eha1990 »

@ tshann and mark_orion: Thank you for your suggestions on how to fix the problem with scratchy sound when running Windows XP as a guest OS in Ubuntu. I added the following to my .asoundrc file:

pcm.!default { type pulse }
ctl.!default { type pulse }
pcm.pulse { type pulse }
ctl.pulse { type pulse }

Saved my changes and set the Audio for Windows XP in VirtualBox to Pulse audio and it competely fixed my problem with audio sounding scratchy when played on the Windows XP guest OS. I thought it was some sort of buffer problem as well.

Thank you for the suggestions, I wanted to let you both know that your recommendations solved my problem.
owain
Posts: 2
Joined: 9. May 2009, 01:03
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows XP

Re: Scratchy Audio in Vista Guest

Post by owain »

That's what I've got in .asoundrc already, so no luck there. However, I did notice a while ago that one program, which had an option to work at 48KHz rather than 44.1KHz, could play clear audio with this. So I wonder whether it's to do with resampling, as both my internal and USB soundcards work at 48KHz? (Being on a slow laptop hard drive coupled with resampling, I mean...)
fmcdavid
Posts: 4
Joined: 19. Feb 2010, 08:09
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: win7,kubuntu 9.10

Re: Scratchy Audio in Vista Guest

Post by fmcdavid »

I played with everything to get the cruddy sound working. Tried different sound setups on the host, recompiled the kernel to change the timer setting from 100 (went to 1000...no luck, better maybe, but not good enough). Finally, I punted and set the number of cpus to 1 and turned off 2d acceleration. Eureka! One or more of all that was certainly not necessary, but I'm not backtracking...it's fine. Thought I'd post in the name of "something else to try"
fmcdavid
Posts: 4
Joined: 19. Feb 2010, 08:09
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: win7,kubuntu 9.10

Re: Scratchy Audio in Vista Guest

Post by fmcdavid »

setting things to 1 cpu worked worked pretty well. I don't think acceleration mattered.

Upgrading to bleeding edge ubuntu kernel 2.6.32 seemed to help a little (required new X packages to keep things working).

But the weird thing is that, as long as I have 'pavucontrol' running, audio in the Win7 guest is almost tolerable and when I close it, it degrades back to unusable.
fmcdavid
Posts: 4
Joined: 19. Feb 2010, 08:09
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: win7,kubuntu 9.10

Re: Scratchy Audio in Vista Guest

Post by fmcdavid »

This page has some hints for improving pulseaudio performance as well. Specifically, setting default-fragment-size-msec = 5 in /etc/pulse/daemon.conf has greatly helped.

http://fedorasolved.org/Members/fenris0 ... orkarounds
fmcdavid
Posts: 4
Joined: 19. Feb 2010, 08:09
Primary OS: Ubuntu other
VBox Version: OSE other
Guest OSses: win7,kubuntu 9.10

Re: Scratchy Audio in Vista Guest

Post by fmcdavid »

Last post on this topic. Everything I did (past few posts) was tested using Netflix player and I'm pretty sure I managed to squeeze every ounce of performance out of it because it really is _almost_ watchable now. After being a bit discouraged messing with it all night, I tried playing some of the media files that win7 installs by default and was blown away. Sound is now flawless. I had tried them at the start of this exercise (just after getting sound working using AC97 driver and OSS host audio in ubuntu 10) and I was seeing broken audio comparable to the netflix player's cruddy performance (now somewhat improved).

To summarize what I did to get audio working:

* recompile host kernel changing timer setting (under processor type menu) from 100Hz to 1000Hz (possibly overkill...saw recommendations for 250Hz)
* drop to 1 cpu (possibly not necessary...definitely helps netflix player)
* Upgrading to bleeding edge ubuntu kernel 2.6.32
* upgrading x packages via this ppa: http://ppa.launchpad.net/xorg-edgers/ppa/ubuntu
* ensure 'pavucontrol' is running (seems like a hack, but it's very necessary for me)
* use pulseaudio atop alsa as sound system (and select pulseaudio in vm settings)...making this happen required some work beyond scope of post
* for me, since I have an intel hda-based card, follow steps in "If you have an Intel HDA card" section in http://fedorasolved.org/Members/fenris0 ... orkarounds
* change /etc/pulse/daemon.conf as follows:
realtime-scheduling = yes
default-fragments = 8
default-fragment-size-msec = 5

If someone who understands this stuff better than me can clean this up (to remove need for running pavucontrol, for instance), I think this would make a great addition to the faq.

One thing worth noting, where netflix is "almost watchable", hulu audio is flawless...framerates are probably comparable.
Post Reply