Choppy sound with WSLg on Windows 10
Windows build number:
10.0.19045.2311
Your Distribution version:
Ubuntu 22.04
Your WSL versions:
WSL version: 1.0.0.0 Kernel version: 5.15.74.2 WSLg version: 1.0.47 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19045.2311
Steps to reproduce:
sudo apt install vlc
vlc /path/to/music.m4a
WSL logs:
pulseaudio.log stderr.log weston.log
WSL dumps:
No response
Expected behavior:
Smooth audio playback
Actual behavior:
Very choppy audio playback (can hear sound every other second or so).
Please note that the upgrade to Store wsl worked like a charm, and my linux GUI apps work flawlessly.
Same here. I get this with most RDP really, but this is particularly bad, which makes no sense for something that's entirely local. I have my own reasons not to upgrade to Windows 11, and am very glad that these things are available on Windows 10 now. I was planning to make use of emacspeak in wslg as I'm a blind user, but I can't go half a second without jitter, pops and clicks, or some kind of ring modulated garbage due to buffer underruns. Even with something as simple as running espeak-ng and typing some text into it. I should note that my tests so far haven't actually spawned a GUI, but the subsystem seems to activate anyway. Using pulse audio I believe. This is Ubuntu 22.04, fresh install after the store upgrade, with systemd.
Trying to play a 10MB mp3 file - stutters very couple seconds
WSL version: 1.0.3.0 Kernel version: 5.15.79.1 WSLg version: 1.0.47 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19044.2364
Same here: Windows 10, WSL2 updated to latest. GUI apps work but playing an mp3 file in vlc stutters
Seeing this same issue on a fresh install of Ubuntu 22.04 under the latest WSL. Added libpulse0 as noted in https://github.com/microsoft/WSL/issues/9192 to get audio working at all, but playing flac files via cmus leads to stuttering audio. The same setup on Ubuntu 20.04 works correctly.
Same issue.
Same issue. Is there any solution?
Also encountering this with terminal audio apps (e.g. ncspot) on Windows 11, so I don't think this is strictly related to GUI
Same issue, CMUS and VLC sound is sluttering, but mpg123 sounds perfect, don't know why
Just did this, and now it works great
sudo apt install pulseaudio pavucontrol -y
pavucontrol is a GUI, so you may not need it
Nah, problem still persist in CMUS, but VLC is acting strange, i'm getting corrupted audio for about 10 seconds, and then it "repairs" itself
I've also got this issue in WSL2 in Ubuntu. I am trying to play an audio file using the miniaudio.h c library. It manges to play fine for about 29 seconds and then the audio becomes very choppy. You only hear a little note every one or two seconds. I have replicated this issue with cmus too.
Audio clips below 29 seconds seem to work fine. Any idea what might be causing this?
I am on Windows 11
Only could get it working with ffplay so far, same issue with vlc
Just did this, and now it works great
sudo apt install pulseaudio pavucontrol -ypavucontrol is a GUI, so you may not need it
For me installing pavucontrol fixed the choppy issues. It would come back if I leave WSL running for a long while. But then restarting WSL fixes the issue.
Same issue, Ubuntu 24.04, in VLC audio playback is choppy all the time, some other apps like Pyxel for example work for a bit, but then the audio starts getting out of sync, and ends with a lot of stuttering.
pavucontrol is installed, but it didn't fixed the issue, I'm in Windows 10, and I'm a game developer, I cannot test my linux builds with this problem, someone have a fix?
Running into the same issue, also Win 11 WSL2 on Ubuntu 24.04.
I've got a homemade mp3 player in C++/SFML that shows an FFT spectrum of the nearest N samples to either side of the player head. Works like a charm on my Win 10 machine (through pulseaudio.exe and an Xserver on the Windows side, not WSLg) but stutters horribly on my Win 11 machine with WSLg after ~20-30 seconds. There's also a noticeable desynch between audio and graphics that starts small but gets progressively worse over time, up to several seconds. The choppy bits of audio continue to play for a few seconds after either closing the WSLg window or ^C-ing the program.
Interestingly, when the audio starts to stutter, the FFT visualization stutters as well but afaik the framerate is otherwise stable--this should only happen if the player head is literally skipping around in the sample buffer, so I was thinking maybe this is a bug in the way OpenAL (SFML dependency) and WSLg interact, but I really don't know jack squat about how either of them work internally.
Tried a whole bunch of crap the first time, including everything on this list and later a 3rd party Xserver like the one I've set up on the Win 10 machine, all to no avail. Got frustrated, wiped & reinstalled Ubuntu, and--get this--it suddenly worked great!... for about two weeks, and then a routine apt-get upgrade the other night borked it again for no obvious reason.
Anybody have any ideas/fixes/packages-to-use/packages-to-avoid?
Same issue here with VLC. smplayer works fine
Same issue meet. Windows10, lastest WSL2, Ubuntu 24.04 i use ffplay, it work fine in first 2min, but the sound turn weird, restart ffplay did not fix it. then i install vlc, but vlc sound more bad. i restart the wsl2. vlc still have issue, but ffplay work fine in 2min.
i try to install pulseaudio-win32 in windows and use module-tunnel in ubuntu to connet windows to create a remote sink. it work well, the sound issue was fixed. So i think the problem probably related to rdp, which i think wslg use to passthrough sound. but this solution is not good enough, the sound latency is too high, myabe 200ms, i still try to fix it.
Same issue meet. Windows10, lastest WSL2, Ubuntu 24.04 i use ffplay, it work fine in first 2min, but the sound turn weird, restart ffplay did not fix it. then i install vlc, but vlc sound more bad. i restart the wsl2. vlc still have issue, but ffplay work fine in 2min.
i try to install pulseaudio-win32 in windows and use module-tunnel in ubuntu to connet windows to create a remote sink. it work well, the sound issue was fixed. So i think the problem probably related to rdp, which i think wslg use to passthrough sound. but this solution is not good enough, the sound latency is too high, myabe 200ms, i still try to fix it.
Sorry to bother, but would you mind sharing the steps to setup this solution? I've been dealing with this issue too and it's really annoying
The problem still occurs when playing video in a browser, when the sound stutters, the video itself starts to lag. At the same time, while everything works, the sound delay is simply crazy for local playback - 200-400ms, it feels like the sound is transmitted over the network.
Same issue meet. Windows10, lastest WSL2, Ubuntu 24.04 i use ffplay, it work fine in first 2min, but the sound turn weird, restart ffplay did not fix it. then i install vlc, but vlc sound more bad. i restart the wsl2. vlc still have issue, but ffplay work fine in 2min. i try to install pulseaudio-win32 in windows and use module-tunnel in ubuntu to connet windows to create a remote sink. it work well, the sound issue was fixed. So i think the problem probably related to rdp, which i think wslg use to passthrough sound. but this solution is not good enough, the sound latency is too high, myabe 200ms, i still try to fix it.
Sorry to bother, but would you mind sharing the steps to setup this solution? I've been dealing with this issue too and it's really annoying
this solution has serious latency problem, i have given up, because this usage is not necessary for me. i can still tell you my try, the think is use pulseaudio's tcp tunnal to transmit the sound.
- install pulseaudio-win32 in windows, remeber select firewall rule to allow the connection when install.
- use apt to install pulseaudio in your wsl2 distro, like ubuntu
- create a remote sink
pactl load-module module-tunnel-sink server=[windowsIP]:4713 channels=2 sink_name=windows[windowsIP] is your windows ip address - use
pactl list sinksto make sure the tunnel connect sucessful, you should see a sink named windows. if not, check and recreate it. - set the new sink as default
pactl set-default-sink windows, finished.
update: i do more hard try and then totally give up. i found there is no way to good enough to control the latency, when the video and sound are transmitted to windows host by different way. So there is no way to make the picture and sound sync. i hope someone can fix it.
Thanks in any case, I'll give it a try
If anyone is still stuck on this the quickest fix as of right now is to switch distro from Ubuntu (24.04) to FedoraLinux-42 and it works near perfectly. For what it's worth if you're stuck on Ubuntu, I do have a number of possible placebos that felt like they helped, disabling Large Send Offload (LSO) for relevant NICs and installing the latest pulseaudio for Ubuntu. For reference, I used firefox-esr for in browser youtube testing, if I recall the performance was better with the native apps. I also performed some vlc streaming experiments with Ubuntu and the audio/video delays were associated with slow-downs in network traffic (clearly visible in a network graph when I bridged the VM to the physical network), but the root cause is unclear. Modifying the kernel parameters for network buffer sizes didn't appear to have much of any effect, probably because the underlying WSL VM's buffers are not being modified, but maybe it's just some weird issue where the CPU was actually choking because it couldn't do something like an AVX instruction shrug. Regardless, switch to FedoraLinux-42, there's some magic happening there that I'm not interested in figuring out how it's different. Also for anyone who stumbles upon recompiling the WSL kernel to go from 250HZ to 1000HZ, I tried that, and it did absolutely nothing. I suppose that's why nobody has a prebuilt version floating around for download, I don't see any other kernel parameters worth changing. I also investigated using Equalizer APO to try to cut down on the pops on Windows, and there are a few filters there, but nothing really worth the headache of installing more software just to make the pops slightly less annoying. It may be worth considering a USB sound card and passing that through to the distro if you're really stuck on Ubuntu. If anyone wants me to experiment with that hack, let me know, a USB sound card is only around $8 these days.
Also appears AlmaLinux-10 works pretty good (the audio locked up once, but no pops!). Probably a better choice than Fedora for any serious long-term work. I wonder if apps are running through Wayland differently somehow...?
Hello everyone,
I was facing the same issue as many others here: audio would stop playing after about 20 seconds on a fresh install of Ubuntu 24.04 on WSL2 under Windows 11.
When I tried playing audio using aplay, I received an "underrun!" error, which made me suspect a time-related issue. Following a suggestion from issue #1257, I stopped the systemd-timesyncd service.
This seems to have completely resolved the problem for me. I have now been able to play audio tracks longer than 10 minutes multiple times without any interruption.
Hope this helps others who are experiencing the same issue.
I use mpv and am still experiencing stuttering/choppy sound even after stopping systemd-timesyncd as well as installing pavucontrol. Adding --audio-buffer=2 to mpv seems to work around the issue for now though.