Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Discussions related to using VirtualBox on Linux hosts.
RamWreck
Posts: 7
Joined: 8. Nov 2009, 19:56
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows 7

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by RamWreck »

chrispitude wrote:Does this match up with what anyone else is hearing? I do seem to be the outlier since I'm running FC11 and not Ubuntu.

- Chris
Oh and I am not sure FC11 vs Ubuntu matters much. Because I bet that sound works fine in your FC11 (as it does in my Ubuntu). It is something with either virtualbox or how the Realtek drivers are interacting with the Virtualbox virtual hardware.
tienhn
Posts: 21
Joined: 7. Jan 2008, 06:03

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by tienhn »

Hi All,
First off, I am glad that I am not the only one who has this problem.

Today I update VirtualBox to 3.1 and updated the GuestAddition as well to 3.1. The problem still remains on my Linux 64 (Ubuntu Karmic) host:

1/ On Windows 7 32 bit guest, using PulseAudio for Realtek 97 device and I also let Windows 7 found its Realtek drive successfully. The result: Sounds still crackle/distorted.
2/ On Windows XP 32 bit guest, using PulseAudio for Realtek 97 device. The result: Sounds works perfectly.

I hope that someone will finally mail this problem down once and for all!!! (Not that I really need to hear Windows 7 to "ding" every time I try to run some program!!!)

Cheers,
chrispitude
Posts: 42
Joined: 2. Jan 2009, 14:22

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by chrispitude »

I agree! I bought a copy of Win7 so I could free up my WinXP for another computer, and I am unable to rearrange my machines until I get working Win7 guest sound. (One of the purposes of my Windows VM is to play music in my office while I work.)

- Chris
RabidSpatula
Posts: 10
Joined: 2. Jan 2010, 19:55
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows (7, XP), DOS, various

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by RabidSpatula »

Ok. So I think I've found and fixed this problem.

Like most of you, when updating to Ubuntu 9.10 I found my windows 7 guest audio was messed up.
It was choppy and distorted, "staccato" I heard someone say in another forum. It was like the
audio was broken up by a timer (which, actually, is exactly the problem).

9.10 is an experimental release. It features pulseaudio now, and a new version of pulse audio
that operates on a timer rather than the old interrupt method that was used. New versions of
vbox have not solved this problem for me, and new versions of pulseaudio have not solved it
either. For some reason having pavucontrol in the background allows it to shift back to the
old interrupt method, so it's a functional workaround. Still, I don't like having to load
pavucontrol every time I boot. Just a waste of time. However, load up a terminal in the host...

% sudo -s
Sudo for a root shell

% cd /etc/pulse
Switch to the pulse config files directory

% ls

You should see a list of files like:
client.conf daemon.conf default.pa system.pa

You should see a default.pa file there. In this file we can change a setting to go back from
the timer method to the old interrupt method.

% sudo gedit default.pa

Up pops gedit. If you're in a root shell you don't need sudo there, I included it just-in-case.

Scroll down to around line 54, you'll see:
load-module module-udev-detect

Change that to:
load-module module-udev-detect tsched=0

Now save the file, exit and reboot (actually you can just kill the pulseaudio user process
and reload it if you want, that'll do the same thing).

Now I do not know if this will break something in a future release (it might), or if it'll
end up being unnecessary if/when vbox and other apps adapt (if they can), or whether a
new release will fudge up your config files later. Just keep that stuff in mind.

Until then, report back if it works. It fixed my pulseaudio problems here (and on a lot of
apps, too).
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by Perryg »

I can confirm that this in fact helps the audio stream in Win7 x86_64 and Vista x86_64 guests as RabidSpatula suggests.
I may make a note that I had to actually uninstall the pavcontrol however to get Vista to work properly.
I would suggest making a backup of the modified file in case an update trashes the default.pa file and hopefully Ubuntu will figure out what needs to be done for a permanent fix soon.
Good work and thank you RabidSpatula for sharing this information.
efffourthirty
Posts: 8
Joined: 25. Feb 2008, 01:24

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by efffourthirty »

Works for me too. One thing I do notice in either configuration is when testing the sound by clicking on the volume adjustment bar in Windows 7 to make a chime, there is either a slight delay before it makes the chime or an initial cracking when making the chime. You can really see if you repeatedly click the volume bar.

Now on the host side when activating these sounds, I see pulseaudio jump from 1% up to 10-20% cpu.

Eff
RabidSpatula
Posts: 10
Joined: 2. Jan 2010, 19:55
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows (7, XP), DOS, various

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by RabidSpatula »

Yes, I've noticed both problems. The leading delay into sounds, sometimes accompanied by a crackle, and the CPU jump.

Fortunately I've got a pretty beefy setup, so I can handle the 5%-10% jump that happens with sounds, but I can see where that'd be an issue.

On my end, the CPU usage clears up when the sound is finished. Does that happen on your's or is it steady?

Hopefully at some point they'll get pulseaudio worked out, and maybe vbox will be able to adapt to the timer method.
efffourthirty
Posts: 8
Joined: 25. Feb 2008, 01:24

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by efffourthirty »

It clears up when the sound is done but now a new problem. I was playing back music on the host and after a few minutes in went into crackling and the Windows 7 guest volume went into crackling and also to a very low volume.

I'll probably restore the Pulseaudio settings and am really considering reverting LTS version of Ubuntu. I rely heavily on my machine for work - yet I still yield to the temptation to upgrade to new releases when they come out.
RamWreck
Posts: 7
Joined: 8. Nov 2009, 19:56
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows 7

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by RamWreck »

efffourthirty wrote:It clears up when the sound is done but now a new problem. I was playing back music on the host and after a few minutes in went into crackling and the Windows 7 guest volume went into crackling and also to a very low volume.
I had a similar experience when trying this fix. Switching back now.

RamWreck
RabidSpatula
Posts: 10
Joined: 2. Jan 2010, 19:55
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows (7, XP), DOS, various

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by RabidSpatula »

ok, I'm not having that problem at all. No sound problems, and crackling (when it happens) only happens for a split second at the very start of the audio.

Which brings me to the next question:
In the host, what kind of audio are you playing? MP3, wave, game of some sort? What player? What quality details on the sound?

And in the guest, same details...

I'm wondering if there's a common app or something that's related to that specific problem.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by Perryg »

My guess is that it is due to the ac97 drivers that the Windows users have to use to get their audio in a guest. I don't think it is compatible with the Pulse Audio and others report the same thing. Windows with the realtek drivers seem to use a different timing scheme then pulse and they just do not get along.
Ubuntu recognizes this as a problem and have backported the alsa program as a work around and supposedly there is some kind of fix (which I have not found yet)
While the workaround the you provided does help it does not fix the issue completely for most. It does return system sounds but playing a stream it still crackles. I also noticed a problem in the host using rhythm box and playing last.fm. Closing the app and restarting brings it back to normal, but this will not be fixed until Ubuntu, pulse, Windows, and VB get it all together (in my opinion)
promet
Posts: 2
Joined: 23. Dec 2009, 20:30
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: Windows XP

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by promet »

Thanks PerryG and all of you guys, for following up this issue so closely. It's kind of a big one for me and I appreciate the information.

Also, PerryG, is there any more detail on this "Ubuntu Alsa backport" issue that you mentioned? Does that mean that we should give "ALSA" rather than the Standard "PulseAudio" in the VB Audio Settings for the host a try? Or am I misunderstanding that, are there any links or keywords I could search the Ubuntu Forums for, to follow where you found that info? Any ideas you could provide would be great.

Thanks again!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by Perryg »

My understanding if they have not yet, they intend to make alsa available in 9.10 (the reason to backport). The sound was changed to pulse audio and this replaced alsa (used in 9.04). I have not proceeded to actually try the regression yet. I was hoping for a fix first and since sound was not a top priority I have not moved into that realm. I will however try to find out more this next week and let everyone know what happens.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by Perryg »

OK I did find the backport for alsa and have removed pulse and installed alsa. (see screen shot)
You want to remove pulse audio and install the linux-backport-modules-alsa-karmic-generic using the synaptic package manager and your sound should work.
I have not tested this on my Ubuntu 9.10 host yet but I see no reason why it should not work. If sound is not that critical to you though you may want to wait to see if they get it fixed.
Of course you can always remove the alsa and install pulse audio again if you need to.

Also the reason I have not tried this on my host is I use a custom kernel (2.6.32-02063202-generic) due to SMP problems with the 2.6.31-16 kernel and am not sure that it will work for me. Should you try and find that this works, please let others know.
Attachments
alsa-backport.jpg
alsa-backport.jpg (73.23 KiB) Viewed 9523 times
RabidSpatula
Posts: 10
Joined: 2. Jan 2010, 19:55
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Windows (7, XP), DOS, various

Re: Upgraded to ubuntu 9.10 and the audio on Windows 7 distorted

Post by RabidSpatula »

I've got alsa installed here and even with vbox set to use it, I still get heavily distorted audio. If I switch to pulseaudio and apply
the fix, it seems to work fine. Make sure you've got vbox set to run w/ pulseaudio if you're trying to work with the fix, if not, that's
probably the problem. The thing to know about the new 9.10 pulse audio is they've changed from the interrupt method to a timer method,
and not everything is timer friendly. With scheduling set to 0 in the default.pa (and after a reboot), it sets PA back to the interrupt
method.

Once the fix is applied and everything set to use pulseaudio, I get no more distorted audio in vbox. I do occasionally hear a little
leading crackle and a little pause before sounds, but I can live with that for now (I'm talking about a 5% cpu bump, a half second delay
maybe a 1/3rd of a second crackle). Now if you can provide specific settings, application and sounds and stuff, I can try to replicate
the problem here. If I can replicate it, I can find the problem and get a workaround (and maybe get a bug submitted to the project).
But without that, I can't do anything.

But if we can identify the settings and every little detail, and manage to replicate the problem down to a science, then we can get a
confirmed bug report on the appropriate projects and perhaps get a fix. Otherwise, it'll prolly never happen.

I'm using windows 7 guest, ubuntu 9.10 (gnome) host. I've got realtek audio drivers working fine and guest additions installed.

For example, if I go to windows 7 guest, fire up firefox and go to youtube and go here:
http://www.youtube.com/watch?v=LO3n67BQvh0

The audio and video sync and play perfectly.

With rhythmbox and last.fm, it plays perfectly as long as I don't screw with the volume. If I turn the volume down with the tray icon it
goes crackly and distorted. If I turn the volume back up, it's all good again. This only happens if I do it while a song is playing, if
I pause it and turn the volume down there's no distortion. If I adjust the volume in pavucontrol, there's no distortion either. It's
only when I use the default volume adjuster that the distortion happens. While this is playing my pulseaudio shows 24% CPU load.

I find that if I do that enough, eventually pulseaudio craps out completely and everything becomes distorted. I was able to fix this
by killing and restarting the user pulseaudio program. In a terminal:

% killall pulseaudio
% pulseaudio &

That fixes the sound, altho it nuked my taskbar volume adjuster for some strange reason.

Try this stuff out, get as much info as possible on what works and what doesn't. Include the audio settings of your vbox (settings -> audio)
if you can.
Post Reply