Crackling sound in Windows 10 64-bit

Discussions related to using VirtualBox on Linux hosts.
CarbonPepper
Posts: 9
Joined: 29. Sep 2014, 21:10

Re: Crackling sound in Windows 10 64-bit

Post by CarbonPepper »

AirKetchup wrote: 4. set the number of cpus to 3 or more
Confirmed! Thank you!

Running Ubuntu 18.04, I've had this problem with a few Windows 10 VMs for over a year (on 16.04 hosts as well).
Sound was running fine on Windows 10 VM, using vanilla install with Pulseaudio sound, but after a windows update the sound became choppy. Another separate win 10 VM was fine, and duplicating settings from one to the other made no difference. I held back on letting the second VM do a windows update, but did eventually and then it got the problem too.
Even a fresh windows 10 build from latest iso had the same problem. I was Baffled. I tried the AC97 route, but the driver install always crashed out.

Nothing made any difference whatsoever. Until I just tried this.

SOLVED for me:
Without making any other changes to host or VM, changing VM from 2 cores to 4 cores (on a 16 core host) instantly made Pulseaudio sound work perfectly.


:D
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Crackling sound in Windows 10 64-bit

Post by mpack »

I suspect you just exchanged one (cosmetic) problem for a genuine long term problem. Probably you have a 4 core host CPU. You just assigned all four cores to the VM. What effect do you think that could have on the host, which now has 0 CPU cores for its exclusive use? How successfully or smoothly can the VirtualBox host process (and the rest of the host OS) run with 0 cores?
CarbonPepper
Posts: 9
Joined: 29. Sep 2014, 21:10

Re: Crackling sound in Windows 10 64-bit

Post by CarbonPepper »

mpack wrote:Probably you have ....assumption, assumption, etc.
As I stated above your post, the host has 16 cores. It also has 32Gb ram. This scenario is wholly repeatable, and fits with rigour. Use the info as you wish.

I would prefer not to consume so many resources, but there's only so much waiting one can take.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Crackling sound in Windows 10 64-bit

Post by mpack »

CarbonPepper wrote: As I stated above your post, the host has 16 cores.
Ah, so you did. A couple of words missed in your final sentence. Sorry about that. However most people reading your post will have 2 or 4 cores and my comment was always for their benefit.
CarbonPepper wrote: I would prefer not to consume so many resources, but there's only so much waiting one can take.
My own solutions are simpler: I turn off audio in the VM, or I live with the crackling. To me it is obvious that our ears are sensitive to the slightest distortion in audio, and there is no way a VM can guarantee to have the resources needed to sustain any data rate glitch free out of the guest and into the host sound card, not when the data is having to travel via some virtual chipset. If it was a paravirtualized audio then things might be different.
ractar28
Posts: 1
Joined: 23. Jan 2019, 23:13

Re: Crackling sound in Windows 10 64-bit

Post by ractar28 »

I have run into this issue and the fix is annoyingly simple. Your issue may not be the same as mine, but... on the guest system, go into control panel, sound (or click the magnifying glass and type sound). Highlight "speakers" and click "configure" . Change audio channel to "stereo". Click test and see if this fixes the issue. If not, try one of the other settings. Then next, next, finish.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Crackling sound in Windows 10 64-bit

Post by mpack »

Surely that fix (which has been the standard for years) has been mentioned already in this thread? In any case yes, if you reduce the data requirement then you reduce the chance of data streaming glitches. Getting 5.1 audio to work in VirtualBox has always been dicey. 2 channels is easier.
brazuser
Posts: 2
Joined: 20. Apr 2019, 10:04

Re: Crackling sound in Windows 10 64-bit

Post by brazuser »

Hello friends.

I am a Brazilian user and I know little English. Therefore excuse any mistake in writing; I'm using Google translator.

There are times my virtual machines have been sizzling in the audio, sounding the sound, also the report of all here.

I read all the pages until this my post. I followed all of the tutorials and instructions quoted by my friends, installed the AC97 audio they requested, moved the settings of the VMs and the host OS (W7 64bits) to make them equivalent in audio options, processor cores, video memory, as administrator, etc., but without any success.

My virtual machines are made up of Linux Ubuntu 18 64bit, Windows 7 32 and 64bit, Windows 10 64bit.
My current Virtualbox is 5.2.28r130011.

What worked for me was to move the directory (folder) from the virtual machine to an SSD. That simple.
It seems there is an incompatibility of some driver or files that bridges (communication) between the host and the virtual system. This causes a delay in audios and videos causing distortion and tearing.

Earlier, in addition to the perforated audio, the video also contained Tearing (equal to the game's screen slots). All virtual machines were installed on HDD.

After moving the machines to an SSD (SSD PLUS 240GB SANDISK 2.5 "SATA III) the problem on all VMs was remedied.
I did all the tests using YouTube audio and the system itself, streaming online radios, used the videos in Full HD, zoomed in to the entire screen size and everything went smoothly, without gagging.

Follow the same post in Portuguese so that Brazilian friends can also find this help.

That's all. Thankful!

---------

Olá amigos.

Sou usuário brasileiro e pouco sei de inglês. Portanto desculpem qualquer erro na escrita; estou utilizando o Google tradutor.

Há tempos minhas máquinas virtuais vem apresentando chiado no áudio, picotando o som, igualmente o relato de todos aqui.

Li todas as páginas até este meu post. Segui todos os tutoriais e instruções citadas pelos amigos, instalei o áudio AC97 que pediram, mexi nas configurações das VMs e no SO hospedeiro (W7 64bits) a fim de que ficassem equivalentes nas opções de áudio, núcleos de processador, memória de vídeo, coloquei como administrador, etc., porém sem sucesso algum.

Minhas máquinas virtuais são compostas de Linux Ubuntu 18 64bits, Windows 7 32 e 64 bits, Windows 10 64 bits.
Meu atual Virtualbox é 5.2.28r130011.

O que resolveu para mim foi mover o diretório (pasta) da máquina virtual para um SSD. Simples assim.
Ao que parece há uma incompatibilidade de algum driver ou arquivos que faz a ponte (comunicação) entre o sistema principal e o virtual. Isto causa um atraso em áudios e vídeos causando distorções e Tearing.

Antes, além do áudio picotado, o vídeo também continha Tearing (igual aos rasgos de tela dos jogos). Todas as máquinas virtuais eram instaladas em HDD.

Após mover as máquinas para um SSD (SSD PLUS 240GB SANDISK 2.5" SATA III) o problema em todas as VMs foi sanado.
Fiz todos os testes utilizando áudio do YouTube e do próprio sistema, streaming de rádios online, utilizei os vídeos em Full HD, ampliei para o tamanho da tela toda e tudo transcorreu normalmente, sem engasgos.

Segue o mesmo post em português para que os amigos brasileiros também possam encontrar esta ajuda.

Foi só isto. Grato!
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Crackling sound in Windows 10 64-bit

Post by mpack »

brazuser wrote: What worked for me was to move the directory (folder) from the virtual machine to an SSD. That simple.
It seems there is an incompatibility of some driver or files that bridges (communication) between the host and the virtual system. This causes a delay in audios and videos causing distortion and tearing.
Not really, I suspect. By moving the VM onto faster media you reduced the media I/O overhead, allowing more I/O time for transporting audio data. This would only work if your VM was spending a lot of time accessing the disk, otherwise it would free up nothing.
brazuser
Posts: 2
Joined: 20. Apr 2019, 10:04

Re: Crackling sound in Windows 10 64-bit

Post by brazuser »

Right.

Well, that's what worked for me. Who knows, help someone.

I've also used Virtualbox for a long time and before that it did not happen, nor in HDDs. I've always used it on HDDs.
It was after performing one of the (old) updates that this happened and it was never the same again.

Thank you!
Last edited by socratis on 20. Apr 2019, 21:58, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Crackling sound in Windows 10 64-bit

Post by mpack »

brazuser wrote: I've also used Virtualbox for a long time and before that it did not happen, nor in HDDs. I've always used it on HDDs.
It was after performing one of the (old) updates that this happened and it was never the same again.
That is in the nature of the problem. The difference between barely enough bandwidth (clean audio) and not quite enough (crackly audio) will be very small. Almost anything can make the difference.
Puterdo Borato
Posts: 1
Joined: 13. Dec 2018, 16:54

Re: Crackling sound in Windows 10 64-bit

Post by Puterdo Borato »

Just want to have a bit of sum-up.
Apparently there are multiple issues being mixed.
The problems in VBox itself: tickets #15295 and #17225 and the changes in Windows host.
My setup is (for the same hardware):
Guest: Win7 x64
a) Host: Win2012R2, VirtualBox 5.1.30 - sound just works great. Any newer version of VBox breaks sound to some extent on this host OS.
b) Host: Win10 1909, VirtualBox 6.1.4 - sound works acceptable on this host OS compared to any previous VB versions (including 5.1.30) but still sometimes has artifacts - in general worse compared to a).
In the neighboring topic (Re: Sound Problem With VirtualBox -5.2.x branch) the version 5.0.40 was claimed as last version working with no issues at all but I didn't try it on Win10 host.
Also i've tried ICH97 audio with Realtek drivers and it replaces problems with crackling and synchronization by occasional silence, which is more pleasant than crackling though.
So it looks like over time 6.x versions are getting better on Win10 host.
antevans
Posts: 8
Joined: 30. Aug 2013, 12:04

Re: Crackling sound in Windows 10 64-bit

Post by antevans »

I've been having audio problems in Windows guests since a Win10 update around four years ago. None of the helpful suggestions on the forum or bug database has ever provided a durable fix. Many seem to fix the problem because the problem is usually helped by a reboot, which most changes require. But the bad audio always comes back, at random.
Just wanted to mention a workaround: if your guest is Windows 10 Pro, you can start a headless (optional, to save resources) VM and remote into the guest via RDP. Audio will be fine because you are not using VB audio. You must first switch off 3D Acceleration for the VM, or the RDP session will abend with a guest driver error.
ReallyVirtual
Posts: 4
Joined: 29. Apr 2021, 18:22

Re: Crackling sound in Windows 10 64-bit

Post by ReallyVirtual »

The audio crackling problem seems to be an artifact of windows 10 using smaller audio buffers than windows 7 - and VB not keeping up.

In short, guest windows cannot process the audio IRQ fast enough under virtualbox and an audio buffer underrun occurs.

Windows 10 reduced the audio latency (and thus the buffer size) from 10ms -> 1ms. This means if the virtual machine is not fast enough to provide the next buffer you will heard crackling/breakups.

Before debugging the issue in guest VM, please make a SNAPSHOT so you can roll back if the tinkering goes wrong.
First try:

1] Power managament - high performance mode in guest OS
2] Disable audio enhancements
3] Network driver IRQs can interfere, change network adaptor options on guest Intel adaptor, to "interrupt moderation rate" = HIGH
This reduces the number of IRQs processed for the network driver per second, slightly increasing network latency, though giving more time for other (sound) drivers
[4] Make sure you have enough non throttled CPUs allocated to windows 10 guest. (e.g. 3-4)

Above reduces (sometimes fixes) the problems.

If you stil have problems, you could try LatencyMon. This detects latency issues , reports misbehaving drivers
Let LatencyMon run for a while, look at the 'Drivers' tab. sort by 'Highest Execution' - gives an idea what might be causing the issue.

Suggestions for Oracle team:
[a] Optimise VB to reduce outlier IRQ processing time and in particular DPC execution time. Average processing time is fine, poor outliers - the top 1% of time is horrible - which causes issues.
Work on putting audio onto a seperate IRQ system with increased priority.
[c] Look at increasing the audio buffer size for default audio device (Guest additions?) - increasing audio buffer size allows more time to handle other IRQ outliers.
[d] There are a number of utilities around (.e.g LatencyMon) which you can use yourself to detect if you have a 'realtime' multimedia system. VB currently isn't with Windows 10.
Leponen
Posts: 1
Joined: 4. May 2021, 07:23

Re: Crackling sound in Windows 10 64-bit

Post by Leponen »

CarbonPepper wrote:
mpack wrote:Probably you have ....assumption, assumption, etc.
As I stated above your post, the host has 16 cores. It also has 32Gb ram. This scenario is wholly repeatable, and fits with rigour. Use the info as you wish.

I would prefer not to consume so many resources, but there's only so much waiting one can take.
Even it was somehow mis-interpreted-aligned whatsoever so called answer it was not that far thrown.

I have similar hw setup with you, host pc with 16 cores and 32GB ram. VM guest had 8 cores + 8GB ram allocated and I was experiencing sequential crackling in audio.

Looked up everything having assumption in mind the resources for VM was enough.

Most likely resources in my original configuration are fine but something else which I cannot explain happens.

It is possible the problem might have something to do with resource scheduling issue with larger amount of cores in VBox HV. Issue where guest VM cannot keep the clock, clock gets synchronized sequentially and causes lost/discarded audio packets in rtp stream. Guest DSP sees the "jump" in rtp stream time stamps due clock synchronization issue. Such clock related jbf etc. issue could be possible to verify/discard with some rt measurement experience but I do not have time for it now.

Someone please have a comment for this clock issue?

After shrinking the VM cores to 4 and RAM to 4GB the crackling periods in audio went away.

My HOST is WIN 10. OS build 1909 (which has been terrible by various means) Guest is Ubuntu 18.04.

I'm using Win 10 as host just to run the VBox + VM for work/background/teams/spotify etc. as daily use desktop for work. So it was annoying thing i could not solve before reading that random answer thrown.
antevans
Posts: 8
Joined: 30. Aug 2013, 12:04

Re: Crackling sound in Windows 10 64-bit

Post by antevans »

antevans wrote:Just wanted to mention a workaround: if your guest is Windows 10 Pro, you can start a headless (optional, to save resources) VM and remote into the guest via RDP. Audio will be fine
More notes on this: if your RDP client is on the same box as the VM, i.e. you are using RDP from host to guest, you will probably want to tweak your networking.

This port forwarding setup worked for me using NAT. Each VM will need its own two entries with a unique arbitrary host port (33890 here). Switch off VB Remote Display and 3D Acceleration in the Windows guest settings. You will need to make sure that remote access is enabled (sysdm.cpl) in the guest.
Name    Protocol HostIP    HostPort GuestIP Guestport
RDP     TCP      127.0.0.1   33890            3389
RDPUDP  UDP      127.0.0.1   33890            3389
You obviously then RDP to 127.0.0.1:33890. This does get confusing if you are accessing more than one VM with different credentials using mstsc.

Why bother? You will have perfect audio. Everything else will be, well, very RDP.

No-tweak option: You can instead run bridged adaptors and ignore all of this, but if everything is on the same box, then all the RDP traffic is going over your network twice.
Locked