Skip to content
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

No sound in CS2 #3256

Closed
returntoreality opened this issue Sep 27, 2023 · 201 comments
Closed

No sound in CS2 #3256

returntoreality opened this issue Sep 27, 2023 · 201 comments
Labels

Comments

@returntoreality
Copy link

Your system information

Please describe your issue in as much detail as possible:

I have no sound. I can see the audio devices in game, but it does not matter what I select, there is no sound. pw-top does not show cs2.

Steps for reproducing this issue:

  1. Start cs2
  2. no sound
@Rosentti
Copy link

Rosentti commented Sep 27, 2023

Beat me to it. :D

@kacperoo29
Copy link

Seems like everyone is on the same boat - for me I am getting some devices in sound settings, but the names look like something I would get on Windows instead of Pipewire and some devices are missing.

@Rosentti
Copy link

I'm only getting my microphone's (output?) and some HDMI devices...
image

@hogcycle
Copy link

+1 also having sound issues with Pipewire.

@hogcycle
Copy link

Got audio for a bit when messing with output devices but it didn't hold after a restart. Hoping valve sees this and fixes it quick.

@alou-S
Copy link

alou-S commented Sep 27, 2023

It seems like the issue is caused by CS2 not being able to use either Pulse or Pipewire API natively.
It directly connects to the ALSA Backend which is generally not a good thing since then Pipewire won't be able to use it when CS2 is connected and vice versa.

But yeah audio technically works but not in a viable way.

@tralph3
Copy link

tralph3 commented Sep 27, 2023

Using ALSA directly means the game takes full control of the audio device, which doesn't let any other application use it until its released. Pulseaudio and Pipewire exist specifically to fix that problem (among other things).

@hogcycle
Copy link

Anyone have a workaround yet?

@kiwec
Copy link

kiwec commented Sep 27, 2023

Also using pipewire here.

CSGO used to use pulseaudio when you passed SDL_AUDIODRIVER=pulse as env var. But this no longer works. It also doesn't use jack so you can't use pw-jack either.

@Zipdox2
Copy link

Zipdox2 commented Sep 27, 2023

What audio library does it use? I think with OpenAL maybe we can set the backend with an environment variable.

@Zipdox2
Copy link

Zipdox2 commented Sep 27, 2023

SDL_HINT_AUDIO_DRIVER=pulse doesn't work. 😢

@gibarel1
Copy link

gibarel1 commented Sep 27, 2023

can confirm, no audio on my end either. Although i can select what looks like my headset as output it does nothing
steam system info

@idarlund
Copy link

Same issue here. Pipewire as well. Any workaround?

@moxw
Copy link

moxw commented Sep 27, 2023

SDL_HINT_AUDIO_DRIVER=pulse steam

This worked for me!

@Zipdox2
Copy link

Zipdox2 commented Sep 27, 2023

SDL_HINT_AUDIO_DRIVER=pulse steam

This worked for me!

Doesn't work. Can you give more details on how you ran this?

@moxw
Copy link

moxw commented Sep 27, 2023

SDL_HINT_AUDIO_DRIVER=pulse steam

This worked for me!

Doesn't work. Can you give more details on how you ran this?

I just started steam using that, and opened the game. Got the sound.

@gibarel1
Copy link

SDL_HINT_AUDIO_DRIVER=pulse steam

Can confirm, did that and selected the audio source until it worked.

@Rosentti
Copy link

There seems to be a startup option -sdlaudiodriver, but I'm currently in a match so I can't test.
The game seems to use sound_device_override forced to Source2SDLDefaultDevice.

@moxw
Copy link

moxw commented Sep 27, 2023

SDL_HINT_AUDIO_DRIVER=pulse steam

This worked for me!

Doesn't work. Can you give more details on how you ran this?

I just started steam using that, and opened the game. Got the sound.

Well, you are only able to use cs2 audio, other outputs don't work.

@offsetcyan
Copy link

Same using bluetooth audio. None of the options so far, including launching Steam with SDL_HINT_AUDIO_DRIVER=pulse have worked.

@RuedigerDieter
Copy link

Same problem here:
I'm using pipewire, and testing with my speakers connected to the mobo I am getting sound (most of the time); using my headphones via USB DAC, I'm not getting any in-game sound. Also, the audio stream does not show up in pavucontrol like I'd expect it to.

@returntoreality
Copy link
Author

I was able to get sound after adding -sdlaudiodriver pipewire to the commandline

@Zipdox2
Copy link

Zipdox2 commented Sep 27, 2023

There seems to be a startup option -sdlaudiodriver, but I'm currently in a match so I can't test. The game seems to use sound_device_override forced to Source2SDLDefaultDevice.

image

@gibarel1
Copy link

gibarel1 commented Sep 27, 2023

SDL_HINT_AUDIO_DRIVER=pulse steam

Can confirm, did that and selected the audio source until it worked.

Tried to relaunch steam withou any variables to test other solutions but now it sound works even without the parameter. Will try to see if restarting the system messes it up again

Edit: confirming, restarting messes it

@alou-S
Copy link

alou-S commented Sep 27, 2023

This issue seems to be present in the latest Dota2 Update (Compendium). So yeah it should be fixed soon.

________________________________________
Also the people who the envars fix the problem, the problem isn't truly fixed. The game is just simply being able to directly use the ALSA backend because Pipewire disconnected from it.

@Kaydax
Copy link

Kaydax commented Sep 27, 2023

Putting -sdlaudiodriver pipewire works perfectly for people using pipewire, not sure about pulse but it may be -sdlaudiodriver pulse or -sdlaudiodriver pulseaudio. However for people using jack, -sdlaudiodriver jack does not work and causes the game to state that sound is disabled

@JacKeTUs
Copy link

JacKeTUs commented Oct 5, 2023

So that update a couple hours ago fixed it?

Sorry but i can't reproduce sound cutting off/game crashing not in previous version nor current version (couple hours ago), only increasing delay (#3283)

Your SDL_AUDIO_DRIVER variable just forces SDL to use native Pipewire, may be crashes are related to sdl still defaults to ALSA? Do you have pipewire-alsa or pipewire-pulse installed?

I use Pipewire with pipewire-pulse bridge. Wired USB DAC, 48khz.

@mewkl
Copy link

mewkl commented Oct 5, 2023

I literally restarted the game without the option, no sound.
But then I reverted back to what I did, but same old problem.
I kinda wish I never restarted the game :).
Somehow restarting my pc seems to help a little bit.

systemctl --user restart wireplumber;systemctl --user restart pipewire
By the way, this command doesn't seem to help when running it while in-game.

I use a wired usb dac as well. I have pipewire-pulse installed.
I guess I'll read up again on the difference of the packages.
I only know pipewire-pulse seems to be a compatibility layer for pulseaudio, so I can run pulseaudio stuff on my pc. Not sure what the other package is. I'll google it.

I see you explained what it is, I was kinda in a match playing without sound, so I updated my comment while you already posted that.

As others said I can use alsa and it works, but I can't play any other audio on my system then. It's still broken when using the pipewire back-end.

@JacKeTUs
Copy link

JacKeTUs commented Oct 5, 2023

(Basically pipewire-pulse and pipewire-alsa are compatibility layers/bridges, made to provide sound through pipewire system but Pulseaudio/alsa api. So your old applications, which are working only with alsa/pulse can provide sound through it and through Pipewire)

@lipusik
Copy link

lipusik commented Oct 9, 2023

Does anyone have problems with sound delay? I have a 1-2 second delay in first and other match

@af7567
Copy link

af7567 commented Oct 9, 2023

@lipusik Yes, see the issue here: #3283
If you can, make sure your audio device output sample rate is set to 44100 Hz

@Rosentti
Copy link

When I use the pipewire driver, sound stops working after around a minute. The pulse driver gets more delayed as time goes on. I'd like to just use the pipewire driver as I have pipewire though.

@mewkl
Copy link

mewkl commented Oct 15, 2023

When I use the pipewire driver, sound stops working after around a minute. The pulse driver gets more delayed as time goes on. I'd like to just use the pipewire driver as I have pipewire though.

You can use "SDL_AUDIO_DRIVER=alsa %command%"

When in-game do this in a terminal, while having no video or similar with audio playing: "systemctl --user restart wireplumber;systemctl --user restart pipewire"
If you are using wireplumber and pipewire ofcourse.
Just restart, or if that doesn't work stop whatever services you are using for audio.

Then if your system supports alsa you should be able to change the audio devices back and forth and have good audio in the game, except that you can't have any other audio playing on your system while playing the game.

Maybe this could also be redirected to pipewire-alsa to be able to have other audio signals running at the same time? But I don't know much about pipewire-alsa so yeah.

@slonkazoid
Copy link

slonkazoid commented Oct 18, 2023

Replying to #3256 (comment)

I tried running the game with pipewire-alsa, and you still have to choose between hearing the game or hearing everything else

Using the default device routes everything through PipeWire as it should, but it doesn't do anything in CS2

@SamuelGogarty
Copy link

SamuelGogarty commented Oct 19, 2023

Replying to #3256 (comment)

I tried running the game with pipewire-alsa, and you still have to choose between hearing the game or hearing everything else

Using the default device routes everything through PipeWire as it should, but it doesn't do anything in CS2

using the launch option "-sdlaudiodriver pipewire" in CS2's property menu in steam should allow you to hear audio from more than 1 application, works for me.

@epicbattle1
Copy link

the sound is broken for me on pipewire with -sdlaudiodriver pipewire launch option after today's update, could anyone else test it?

@af7567
Copy link

af7567 commented Oct 20, 2023

I just downloaded the lastest update and sound is working through pipewire with -sdlaudiodriver pipewire OK for me. After 1 game of premier it was still OK with no delay (at 44100Hz)

@epicbattle1
Copy link

I just downloaded the lastest update and sound is working through pipewire with -sdlaudiodriver pipewire OK for me. After 1 game of premier it was still OK with no delay (at 44100Hz)

ok, seems like a problem on my end, thanks for answering

@sylware
Copy link

sylware commented Nov 18, 2023

SDL3 audio is currently under heavy developement, expect breakages, and they really broke it for alsa.

The right way on linux is all games, game engines have only 1 API to care of: the native alsa-lib. The actual software mixer [jack/pulseaudio2(pipewire/gwireplumber)/pulseaudio1/dmix] is hidden behind the alsa API as it should be. jack & pulseaudio2(pipewire/gwireplumber) & pulseaudio 1 are hidden behind an alsa-lib PCM plugin.

I did fix to a recent git SDL3, here:
https://transfer.sh/e9OV53rxIT/libSDL3.so.0 it should work for most alsa user.

@sylware
Copy link

sylware commented Nov 18, 2023

oh, and it tracked there for SDL3:
libsdl-org/SDL#8577

dota2 and cs2 uses the same linux runtime.

@DominikM60
Copy link

Adding -sdlaudiodriver pipewire gives me false hope by working until about 30 seconds into the match. To fix that I have tried to change the sound device and whenever I try it the game completely crashes. To test out if that's an issue only related to Linux i set up Windows 10 on other disk. On Win10 it is even worse as game crashes completely out of nowhere at the moment when on Linux I would lose the sound.

@sylware
Copy link

sylware commented Nov 28, 2023

Look at the SDL audio issue right above, I finished my ALSA audio code contribution.

I have been playing dota2 with alsa dmix multi-channel enabling with it (and testing very little with cs2, namely only the title screen).

@stefan11111
Copy link

When I open cs2, by usb headset doesn't show up in the audio output list.
I can set the output to my laptop's onboard sound card, which works, but I can't set it to my headset because it doesn't show up.
I use pure alsa(no pulseaudio or pipewire).

/etc/asound.conf:

defaults.pcm.card 2
defaults.ctl.card 2

@sylware
Copy link

sylware commented Dec 5, 2023

@stefan11111 as far as I know, SDL3 devs are still reviewing/merging/debugging/etc my alsa code. No news from them, weird as some other fixes went it very fast (like the input bug).

@sylware
Copy link

sylware commented Dec 5, 2023

@stefan11111 I can upload to you a libSDL3 build which is "supposed" to work with cs2 (it works on my system), if you trust my binary.

@stefan11111
Copy link

@stefan11111 I can upload to you a libSDL3 build which is "supposed" to work with cs2 (it works on my system), if you trust my binary.

Sure.

@sylware
Copy link

sylware commented Dec 5, 2023

There, it was linked with a glibc 2.33:

https://transfer.sh/IaIfxX40q2/libSDL3.so.0

Hopefully it will work for you too (this is omega alpha code), and it is working now, 20231205.

@stefan11111
Copy link

Which one should I replace:

$ locate libSDL3.so.0
/home/stefan/.local/share/Steam/steamapps/common/Counter-Strike Global Offensive/game/bin/linuxsteamrt64/libSDL3.so.0
/home/stefan/.local/share/Steam/ubuntu12_32/libSDL3.so.0
/home/stefan/.local/share/Steam/ubuntu12_64/libSDL3.so.0
/home/stefan/Downloads/libSDL3.so.0

Also, my system has glibc 2.38-r1. Will the lib work?

@stefan11111
Copy link

@sylware
Unbelievable, it actually works! Thank you.
I've had some experiences with steam issues on linux, and they never got resolved to quickly.
Got yourself a new follower.

The lib I replaced was /home/stefan/.local/share/Steam/steamapps/common/Counter-Strike Global Offensive/game/bin/linuxsteamrt64/libSDL3.so.0(after backing that up, of course).
Note that, the "Default Device" doesn't actually work, but the usb headset I have does show up in the menu and that option works.

Since you seem knowledgeable about steam, do you know exactly what dependencies proton needs in order to work?
I have tried to run some games via proton, but even the simplest games fail to launch.

@sylware
Copy link

sylware commented Dec 5, 2023

@stefan11111

Glad it works (for now...). I works for dota2 as well.

info: A more recent glibc can run binaries linked with "older" glibcs, but very often (and sometimes certainly), binaries linked with a "recent" glibc won't run on systems with "older" glibcs (most of the time for not really pertinent reasons). That's one of the reasons which make building wide "glibc" spectrum binaries something "hard" (don't expect that from "normal" game devs).

The alsa canonical "default" is actually set by the alsa lib included in the "pressure-vessel" steam runtime (for dota2 and cs2), it may not import your configuration (I use the ALSA_CARD environment which is going thru the container, but I have not tested /etc/asound.rc or $HOME/.asoundrc).

Sorry I am a #noproton guy, I have a lean vanilla git wine/vkd3d... and since it seems (until proven otherwise) proton does include copies of microsoft windowns DLLs, I don't use it. I rarely have something working though (but I got a few interesting windows games working).

@stefan11111
Copy link

stefan11111 commented Dec 13, 2023

Replying to #3256 (comment)

Could you please tell me how to use ALSA_CARD to set the soundcard?
I have 3 sound cards, one is the internal one, one is the nvidia hdmi audio, the third is my usb headset, which is listed as card 2.
What envvars do I need to pass to steam in order to set my sound card to the usb headset?

@JohnDoe02
Copy link

JohnDoe02 commented Dec 18, 2023

I have the rather special problem, that the sound cuts off after a while (can be anything, from 30sec to even 10-15 min on the server -- usually, within 2-5 min though) when playing on the deathmatch servers of warmupserver.net (pipewire 1.0 on arch linux). On Valve deathmatch or premier/competitive everything works fine. I tried everything from -sdlaudiodriver alsa/pulse/pipewire, forcing 44100hz system-wide to even switching back to pulseaudio. Sadly, to no avail.

Once the audio cuts off, I can get it back by switching back and forth with another sound device. However, once I do so, the game tends to crash shortly after (sometimes, the game crashes directly instead of the audio cutting off).

I have not tried other non-official deathmatch servers yet. Ah, and Windows works fine of course.

@kisak-valve
Copy link
Member

Closing because the issue reported here was fixed in late September 2023.

If anyone is seeing follow up issues, those issues should be tracked separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests