Skip to content

CS2 Delayed Audio - Pipewire #3283

Closed
Closed

Description

@kodatarule

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

Please 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:

  1. Just try to play the game using pipewire( launch command -sdlaudiodriver pipewire required otherwise game would be without audio)

Activity

  1. jnvsor commented on Sep 28, 2023

    @jnvsor

    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

  2. ZeroYamaoka commented on Sep 28, 2023

    @ZeroYamaoka

    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)

  3. stealingudc commented on Sep 28, 2023

    @stealingudc

    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.

    valve, pls fix

  4. JacKeTUs commented on Sep 29, 2023

    @JacKeTUs

    Guys, can you retest please if latency will still build up on latest update without any workarounds?

  5. JacKeTUs commented on Sep 29, 2023

    @JacKeTUs

    I tried retest it with latest update - latency is still building up.

    My method of testing:

    • Microphone
    • CS2
    • Audacity
    • Carla

    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)
    After 10-15 minutes - about 110-120ms latency
    Another 10 minutes - about 140ms latency
    Another 10 minutes - about 170ms, already noticeable with eyes
    Another 10 - about 200ms, already unplayable
    Another 15 - about 230-240ms, unplayable indeed

    So latency did build up for me.

    image

    image

    image

    image

  6. JacKeTUs commented on Sep 29, 2023

    @JacKeTUs

    cs2latency.zip
    I exported project to .ogg file, you can try to import it in audacity. Original aup3 is 145Mb, quite big for github
    Timestamps:
    0s - 48s - right after loading the game
    48s - 1m21s - after ~10minutes
    1m22s - 2m04s - after another ~10 minutes
    2m05s - 2m55s - after another ~10 minutes
    2m55s - 3m33s - after another ~10 minutes

    My system information: https://gist.github.com/JacKeTUs/d36b8e75a78f96160fd9c12eeccab18b
    Pipewire 0.3.80, config: https://gist.github.com/JacKeTUs/abc72942af8e96a47a7eba4430fc5643

  7. JacKeTUs commented on Sep 29, 2023

    @JacKeTUs

    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)

  8. szmarczak commented on Sep 29, 2023

    @szmarczak

    I can confirm that the latency builds up (flatpak steam, pipewire).

  9. szmarczak commented on Sep 29, 2023

    @szmarczak

    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 W or MOUSE1 won't be ok :(

  10. NiSchie commented on Sep 29, 2023

    @NiSchie

    Can confirm latency buildup.

    Operating System: Arch
    XFCE Version 4.18
    GTK Version: 3.24.38
    Qt Version: 5.15.10
    Kernel Version: 6.5.5-arch1-1
    Graphics Platform: X11
    Processors: AMD Ryzen 5 3600
    Memory: 16 GiB of RAM
    Graphics Processor: NVIDIA GeForce GTX 1660 Ti
    Sound server: pipewire

  11. jpgay commented on Sep 29, 2023

    @jpgay

    Latency buildup also occurs with PulseAudio.
    System info: https://gist.github.com/jpgay/a6f3f51e590652eef96c91216b1e7e96

  12. itouchdennis commented on Sep 29, 2023

    @itouchdennis

    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:

    [SoundSystemLowLevel] Audio device starved 512 samples

    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).

  13. JacKeTUs commented on Sep 29, 2023

    @JacKeTUs

    Some tinkering:
    Game tries to use pulseaudio by default, and on my system it defaults to pipewire-pulse bridge. On pw-top i can see that game asks for 256 quantum and 48000 rate by default

    Forced pipewire does not help.
    PULSE_LATENCY_MSEC=60 and PIPEWIRE_LATENCY=128/48000 added to launch command did not help. My thoughts was "if i set constant latency, issue will be fixed".

    Also - latency increases even if game is staying in background

    edit: forced pipewire tested

  14. 66 remaining items

  15. boustrophedon commented on Dec 2, 2023

    @boustrophedon

    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)

  16. nadanke commented on Dec 3, 2023

    @nadanke

    Replying to #3283 (comment)

    Okay with -sdlaudiodriver pipewire I still get delay, but it builds up less fast than it does without it (on 192khz)

  17. simifor commented on Dec 15, 2023

    @simifor

    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

  18. ipaqmaster commented on Dec 15, 2023

    @ipaqmaster

    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.

  19. kodatarule commented on Dec 15, 2023

    @kodatarule
    Author

    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.

  20. simifor commented on Dec 15, 2023

    @simifor

    @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.

  21. rLy07 commented on Dec 16, 2023

    @rLy07

    I just played like 5 matches and had no issue at all. I didn't use any of the workaround mentioned here.

  22. ZeroYamaoka commented on Dec 17, 2023

    @ZeroYamaoka

    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

  23. af7567 commented on Dec 17, 2023

    @af7567

    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.
    In my case the default rate is 48000 and I confirmed that the soundcard playback rate was 48000 in the alsa info.

  24. kisak-valve commented on Jan 27, 2024

    @kisak-valve
    Member

    Closing per the last several comments.

  25. MatiasPViecho commented on May 9, 2024

    @MatiasPViecho

    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 :(

  26. simifor commented on May 9, 2024

    @simifor

    @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.

  27. MatiasPViecho commented on Jun 19, 2024

    @MatiasPViecho

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions