-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CS2 Delayed Audio - Pipewire #3283
Comments
I had this occur but only after playing for a few hours. It went away after a game restart but it does happen Edit: Yeah it seems to slowly desync and get later and later from what I've seen |
I had same isuee i changed default sound device in game option to my Soundcard that i use and it fixed the problem for me (Well maybe it will help) |
This hack reduced the audio delay to up to a second for me on Debian 12 with pipewire-pulse. Even so, it's still barely playable.
|
Guys, can you retest please if latency will still build up on latest update without any workarounds? |
I tried retest it with latest update - latency is still building up. My method of testing:
Launch Audacity, set Recording Device - cs2 app. Press record in stereo. In Carla reroute your mic capture to PortAudio device - that's our Audacity. So left channel in Audacity records cs2 and right channel is my mic. I click the mouse and then hear cs2 gunshots. I measure latency between start of a click and start of sound from CS2. Initially right after map was loaded, before mouse click and sound of a gun i had ~90-100ms (of course my system latency / recording software latency/etcetc will affect it, but i didn't change it through tests, nor restart the game / sound system / audacity, etc) So latency did build up for me. |
cs2latency.zip My system information: https://gist.github.com/JacKeTUs/d36b8e75a78f96160fd9c12eeccab18b |
May be it's the Pipewire issue, but i definitely didn't have that desync problem with csgo and other games (osu!lazer for example, rhythm game where sound latency even +-20ms is critical) |
I can confirm that the latency builds up (flatpak steam, pipewire). |
Changing the audio device also fixes the latency issue (you have to actually change the device by selecting it from the menu, and change it back to the old one). The changes takes a few hundred ms to take effect, so binding this to a key like |
Can confirm latency buildup. Operating System: Arch |
Latency buildup also occurs with PulseAudio. |
Having the same problem on pipewire. Did someone test it with alsa ? Yesterday I tried the workaround with the .asoundrc, timings where on point for the time I tested it, but unfortunately my sound got stuttering and cracking after a short while so I did not test it one or two matchmaking games, just for some short deathmatches. My console got also following output while using the .asoundrc file:
Which could indicate a too huge bitrate and a too small buffersize - might take a look this evening to check if I could lower the sample rate and maybe increase a bit the buffer size (I assume the buffer size should not be that huge, as it could also cause delay). |
Some tinkering: Forced pipewire does not help. Also - latency increases even if game is staying in background edit: forced pipewire tested |
@icculus, i believe that you could help us here, maybe? |
I have the exact problem jnvsor described... but I'm on windows 10 I tried reinstalling windows and it didn't fix it. One idea I have is that I can change my USB sound card's buffer size, but even when trying with lower or higher values it doesn't fix it. |
I tested a quick deathmatch with the update today, sound works but seems a bit delayed. I added the start option Might be placebo, need to test more |
Pipewire on ubuntu 23.10 here, i have up to a second delay. Latest public CS2 version. If i shoot i see the 3-4th shot and then the sound starts playing.. |
I think I was able to make a noticeable improvement by doing this - so it might be worth trying different values to see what works best for your setup? I use a S24LE/96khz USB DAC so this may not work for everyone... Launch options:
Seems like you can confirm the change with Before
After
(or look at the This still seems hacky because the application should probably be coordinating better with the pipewire/whatever daemon... this is a random selection of chromium/firefox/mpv/cs2 all playing audio:
@JacKeTUs I think the PULSE_LATENCY_MSEC=60 works even better for me, very crisp - most noticeable with pistols for whatever reason. |
@xstaticxgpx, i tried first with pulse-pipewire bridge, without any arguments and only PULSE_LATENCY_MSEC, and later with forced pipewire with only PIPEWIRE_LATENCY added. With both methods i still had build-up latency issue |
I previously had the same behavior where after ~30min it was unplayable because of the sound delay - now with
So that probably does nothing here for cs2, so maybe you guys just need to try different values? @JacKeTUs Did you mean "forced pipewire" with this? |
Yes, but with Later i tried with forced pipewire with |
Yea something is still messed up here, there is less delay and it doesn't seem to get much worse as quickly, I'm thinking it's related to the number of sounds played and so testing in a bot match vs public deathmatch it manifests differently 🤔 Starting a bot match after extended pub deathmatch play with the sound delay and checking console:
Maybe that's helpful to Valve? Also trying: Remove all envvars, use
EDIT:
Which is a similar issue in DOTA2 apparently: ValveSoftware/Dota-2#2425 No amount of |
Unsure if this is related, but if i play a few games, or leave cs open for a while, it starts to become more and more out of sync |
(It's |
Tested the latest update, the issue is still present. |
I have the same problem on Kubuntu 22.04 (Ryzen 5600x, AMD Radeon 6700XT, flatpak steam) |
I haven't noticed audio getting delayed in the past few days, it's possible that it's fixed at least in some configuration, or perhaps it now takes longer for the delay to become noticeable. But at least for me, the experience has improved. |
The issue is still present. Became very noticeable at the end of two premier matches (~70 minutes total). |
I just tested with the default pipewire settings (48000 Hz rate) and still have this issue, noticeable after 10 rounds. So it still needs the pipewire default rate forcing to 44100. |
One of the workarounds mentioned elsewhere was to enable streamlined push-to-talk, where the input audio device is constantly read. I also enabled playing audio in the background. This seems to more or less fix the issue with my PulseAudio setup with (by default) 48000Hz rate and f32 sample format. Without the workaround I was getting really bad audio delay after less than half an hour of gameplay. |
Worth noting that Pipewire users can use the env var Changing my launch options to the following fixed all the sound delay issues I had that are caused by non-44KHz sample rate usage:
Tested with Pipewire 0.3.84 on the Nov 17 15:25 build of CS2. |
This works perfectly! Thanks! |
This works somewhat, but I had to switch the audio devices back and forth a few times for the sound to start working. I also just experienced a crash after playing a couple matches where my audio interface is no longer detected, even after exiting the game. I also lost control of my keyboard for some reason. |
It doesn't sound right that PIPEWIRE_RATE would make any difference to the alsa driver. Unless alsa is using pipewire as the default output - but then using the pipewire driver instead would remove the alsa->pipewire layer so should work better? |
Thanks for the workaround @ipaqmaster ! I wanted to not remember to push a button all the time. Shooting or moving keys are out of the question because the workaround stops sound for a couple of ms. So I decided to add it when showing score board. This has been working flawlessly for a couple of matches now. Added this to autoexec.cfg (and +exec autoexec.cfg to launch options ofc): And as @ipaqmaster pointed out; check your sound_device_override fist so you know what to put in that last sound_device_override command. As a sidenote; when doing this I'm seeing this in the console: [Developer] Failed to find ui preference 'spec_autodirector_cameraman |
This seems to be fixed? I just noticed I had left my game open for several hours and when I came back the audio wasn't delayed. I have EDIT: nevermind, see below |
To be clear, I think everyone was leaning towards this not being a Pipewire thing, but rather a very-high-sample-rate thing, so I'd like to hear if this is working for the 192,000Hz crowd. |
Just tested. Without With
|
|
I just ran My audio interface seems to support 192000 but running the above command with 192000 doesn't seem to work, when I relaunched CS it was only at 96000. Here's what I'm seeing in
Everything seems fine so far but I've only been playing for maybe 20 minutes. |
I left the game open for several hours at 96000 and the delay is back. I'm on pipewire 1.0.0, which was released a few days ago (but is api/abi compatible with 0.3) |
Okay with -sdlaudiodriver pipewire I still get delay, but it builds up less fast than it does without it (on 192khz) |
has anyone had the delay bug recently? I had the game open for 3 hours and didn't notice a delay. No special launch parameters, system uses pipewire 1.0 |
I haven't noticed it because I forced my DAC rate to 44100 to work around this problem long ago. What is your sample rate set to? If it's higher than 44100 then your evidence is valid. |
I still experience the same delay, it's just very random, sometimes it comes fast, other times it takes some time to be in-game to trigger it. |
@ipaqmaster 48KHz in my case and I used to have the issue in the past but seemingly not anymore. Though clearly there are still people affected. |
I just played like 5 matches and had no issue at all. I didn't use any of the workaround mentioned here. |
Well played some casual matches and didnt notice the problem on 96 KHz good job devs but maybe at least you mention that you fixed the problem in patch notes ? I use pipewire with SoundBlaster Z SE card |
I just tested playing a couple of games using the default pipewire settings on my Slackware system instead of forcing it to 44100 and didn't notice any delay, so seems to be fixed for me too, either by a cs2/SDL update or pipewire 1.0. |
Closing per the last several comments. |
Just got a pair of bluetooth headphones and i'm having the same issue, doesn't seem like any of the solutions provided here works for me :( |
@MatiasPViecho bluetooth tends to have poor latency, so it's likely that and not the game causing the delay. You probably have a delay with other games as well. |
Hey! Quite late to answer but i tested it and yeah, I didn't notice the delay on other games, music and tv shows until you mentioned it, its just that in CS audio is so important that i just happened to notice it there haha |
Your system information
Operating System: EndeavourOS
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.3-273-tkg-bmq (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X3D 8-Core Processor
Memory: 31,3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3090/PCIe/SSE2
Steam
->Help
->System Information
) in a gist: https://gist.github.com/kodatarule/9ffc8a882619307476dde5397642dfb8Please describe your issue in as much detail as possible:
Firstly the game requires a launch command in order to get audio to work under pipewire and second it has a good between 2-5 seconds delay, you see the action on screen and after that you hear the audio.
For CS GO neither of those issues were present.
Steps for reproducing this issue:
-sdlaudiodriver pipewire
required otherwise game would be without audio)The text was updated successfully, but these errors were encountered: