protonscr

Add Sound API Options Under Settings (OSS4, ALSA, JACK)

steamclosed Feature RequestreviewedAudio
ValveSoftware/steam-for-linux#3313 · opened 2014-05-20 by shoober420 · updated 2016-06-17 · 24 comments · github
Sshoober420 2014-05-20 github

Yesterday, I installed OSS4. I was using ALSA prior to this, and Steam games ran and sounded great. I heard many great things about OSS4, and decided to switch over. I'm glad I did. OSS4 is light years ahead of ALSA in comparison with sound quality. One bad thing is, I have no sound in Steam games anymore. I refuse to use any sort of ALSA emulation. When I tried to install "liboss4-salsa-asound2", it wanted to remove my Chromium browser, and Deadbeef audio player. I'm not going to let that happen. Can you please add support for the OSS4 API? If its already supported, how do I enable it to work with Steam?

TTele42 2014-05-20 github

You can use audio backends that are officially unsupported, however, you need to disable the steam runtime and build libsdl2 and openal with support for the audio backend you want to use, you can then use the SDL_AUDIODRIVER env variable to select your experimental audio backend. Openal is selected by ~/.alsoftrc. I am able to do this with JACK, but the libsdl2-jack patch set is far from ready for mainstream inclusion.

Sshoober420 2014-05-20 github

I'm currently using the libasound2-plugins method I found on the OSS4 wiki. It works, but there is noticeable sound lag, which I think is caused by the increased latency. Would you be able to walk me threw how to set up SDL to work with Steam and OSS4 to see if its better then the libasound2 method? I also use libasound2 for sound playback with the Chromium browser. I have a feeling your SDL method won't work with Chromium, but it would at least not sound as laggy as libasound2 does (I hope).

TTele42 2014-05-20 github

No, I am not able to give steps as I do not know of an oss4 patch set for libsdl2. If you're feeling adventurous, you can hack on libsdl2 yourself, as is the nature of foss software.

Sshoober420 2014-05-21 github

I'm no programmer, though as the days go by, I want to learn how to program each day. This point in time, I can't hack libsdl2 or anything for that matter. I guess I'll just stick with libasound2 until maybe some OSS4 support arises. There is definitely noticeable sound lag compared to native ALSA, since its going threw a wrapper, then to OSS4. Its not untolerable, its just, I know native OSS4 would sound so much better. Running OSS4 with ALSA emulation already sounds better then native ALSA, its just theres the sound lag. If Steam could add native OSS4 support, not only would it be snappier then ALSA, it would sound better then ALSA too.

Ffyrak1s 2014-05-23 github

Actually as far as I am informed this is just a configuration issue. You need to configure the backends to use OSSv4. By default they will use ALSA because the default of most distros is ALSA.

You can consult the Archlinux and OSS wiki for steps how to do this http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4
https://wiki.archlinux.org/index.php/OSS#Applications_that_use_OpenAL

Most games use OpenAL or SDL so I advise you to first configure them to use OSS ;)

PS: Am I correct @Tele42 ? Or does the new SDL 2 simply lack OSS support??

TTele42 2014-05-23 github

Libsdl2 does not have oss4 support yet as far as I know, it is not listed as a backend you can pick, nor is there a patch set on the bug tracker.

Ffyrak1s 2014-05-23 github

What about #459 ? Looks like it's supported but "dsp" needs to be specified? Or am I completely wrong again...

TTele42 2014-05-23 github

I assume that without explicitly saying oss4, all generic references to oss mean oss3 (to maintain historic consistency), however this may not be true as is worth testing.

Sshoober420 2014-05-24 github

Could one of you walk me through how to test this out? I don't see Steam listed in the "Configuring Applications for OSSv4". Do I just need to change the alsound.conf file to see if Steam supports OSS4?

TTele42 2014-05-24 github

@shoober420 It should just be running SDL_AUDIODRIVER="dsp" steam from a terminal (steam uses a mix of libsdl2 and openal for audio, this is just sdl2's env variable) if that is ment for oss4.

Sshoober420 2014-05-25 github

Wow, thanks Tele42 and Nuc1eoN. I now have sound in Steam games. OSS4 is the best! They should make an option in settings that allows you to swicth between OSS4 and ALSA. Its kind of annoying having to type in SDL_SOUNDMIXER="dsp" everytime I start Steam. Making a bash script is just silly, considering how this should be an option in settings.

TTele42 2014-05-26 github

@shoober420 just to be overly clear, SDL_AUDIODRIVER="dsp" works with OSS4?

...and to the main topic: You should look for / ask around what config files are processed when you launch your X session / DE session. On my system (gentoo) I run export SDL_VIDEO_FULLSCREEN_DISPLAY=0 in ~/.bashrc to get sdl1 fullscreen applications to behave a little better with multiple monitors. This can vary by distro, so that may not be the right file for you.

Ffyrak1s 2014-05-26 github

@shoober420 please get sure that it doesn't use ALSA emulation by mistake.
But as I said it appears that SDL does support OSSv4.
@Tele42 Is there acutally no config file to set it? And will it then only work if steam is started via terminal or via GUI too?

PS: But actually shouldn't it work automaticly? Setting the env variable should actually be optional...
Also see http://www.opensound.com/wiki/index.php/Configuring_Applications_for_OSSv4#SDL.2C_including_SDL-based_like_frozenbubble
(as far as I remember SDL apps worked out-of-the-box for me)

Sshoober420 2014-05-27 github

Nevermind, my mistake. I had ALSA emulation enabled. I forgot to rename my .asoundrc file. When I renamed it to disable the ALSA emulation, I had no sound again. My bad. Please Valve, add native OSS4 support.

Ffyrak1s 2014-05-27 github

What do you mean? I don't understand.. so when do you have sound and when not?
Actually SDL should support OSS4 out-of-the box but the general issue with emulation is, that the emulation is used instead of the real oss. This is of course becasue of ALSA being preconfigured as default. Setting the environment variable specifies to use OSS4 preferably.

A general problem with ALSA emulation is that some programs probe for driver support in the order "ALSA, OSS". So programs that were using OSS by default may now try to use the emulation with possibly inferior results. So if there are problems after installation, make sure the program uses the OSS support if available rather than the emulation:

from http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ALSA_Emulation

So this is not really a Steam issue, or maybe partly (Emulation+ALSA Default). So you need to instruct SDL to explicitly use oss4 (as pointed out above, just set the env variable)..
Is this clear enough? Also @Tele42 do you aggree with everything?

TTele42 2014-05-27 github

The behavior I know out of libsdl2 is that it goes for the env variable first, then pulseaudio, then alsa. The quote given sounds like the OSS3 compatibility layer found with the alsa kernel modules.

ADDITION: This is the first of I've heard of "OSSv4 cuckoo module," and I know nothing about it.

Sshoober420 2014-05-29 github

Without ALSA emulation via libasound2, and the .asoundrc file present, I will have no sound in Valve games. The games that support OSS natively, like Killing Floor and Amnesia for example, will have sound. I don't even need to start steam with the SDL_AUDIOMIXER command to get sound in those games. But, in Valve games, like Counter-Stike 1.6 and Left 4 Dead 2, I get no sound unless I enable ALSA emulation. Valve games seem to not support OSS4.

Ffyrak1s 2014-05-29 github

I don't even need to start steam with the SDL_AUDIOMIXER command to get sound in those games.

Hm, so my assumption that oss4 should work out of the box is correct.
This is really an issue that should be addressed by valve then (or the libsdl2 devs)..

TTele42 2014-05-29 github

Killing Floor and Amnesia are both OpenAL games, which we know works with OSS4.

Sshoober420 2014-05-30 github

Nuc1eoN
Hm, so my assumption that oss4 should work out of the box is correct.

As long as the game supports OSS4, then it should work out of the box. Amnesia even has a options to select between OSS4 and ALSA under Audio settings. Killing Floor just works somehow. I guess it intelligently selects the right Audio API. I assume we have OpenAL to thank for that.

Tele42
Killing Floor and Amnesia are both OpenAL games, which we know works with OSS4.

What about Valve games? I'm not sure if there OpenAL or not. I doubt they are, since I can't get sound from them unless I enable ALSA emulation. I have a feeling that SDL_AUDIOMIXER option gives the Steam software sound, but not the games itself. Like for example, all the Steam sound effects, like chat and error sound effects.

TTele42 2014-05-30 github

"As long as the game supports OSS4, then it should work out of the box." -> If the audio middleware works with your audio stack of choice, then you can override the libraries / config and all games using that middleware will work. I know this as a fact as I have a rare audio stack (JACK + alsa loopback device).

Valve games use libsdl2 for the game engine, and openal for voice chat.

@shoober420 you keep saying SDL_AUDIOMIXER, I don't know where you got this env variable, and hope you've ment to type SDL_AUDIODRIVER. Libsdl2 needs to support OSS4 in some capacity before valve can consider what to do to make it work out of the box. As much as you like OSS4, the OSS devs expelled themselves from the linux community for several years, and ALSA was made to fill the void. It's not pretty, but the next step in the process is to make patches for libsdl2 yourself or encourage others to look into doing it for you (and all other users with OSS4).

Steam itself primarily uses openal.

I'm going to refrain from commenting further on this issue report as your request has been clearly stated and there is nothing more productive to add at this time.

Sshoober420 2014-05-30 github

Oh, my bad. I must have looked at the command wrong. I'll try using SDL_AUDIODRIVER and see if it works. I found another github issue from googling "libsdl2 oss". Its issue #459. He didn't comment back, so maybe it actually worked for him. I'll post back with the results.

Ffyrak1s 2014-05-30 github

I have just tried to reproduce your situation, but come to diametrical results:
It appears that I get native OSSv4 sound in Steam itself (e.g. Big Picture Mode) and HL2: Deathmatch. I have diabled ALSA emulation prior to get exact results.

Since HL2 is a valve game I assume that it makes use of libsdl2, so I have been right with my assumption: SDL2 does support OSSv4 right out of the box, setting the env variable should be optional (this might vary from configuration to configuration of course; I did not use the env variable).

@shoober420 I really don't know what's wrong with your configuration, but as suggested try to apply the env variable correctly and see it it helps. Also don't forget to test with ALSA emulation disabled or better uninstalled.

Sshoober420 2014-05-31 github

You guys are right, it does support OSS4. I was just using the wrong command. Thanks for sharing the solution. It would be nice if Valve would add an option to choose between OSS4, JACK, and ALSA under settings so I don't have to type in "SDL_AUDIODRIVER" everytime I start Steam though.

I also have to enable "cooked mode" in the OSS4 conf file, so I can get sound for Goldsrc games. Goldsrc games only run at a maximum of 22Khz. My sound card (ASUS Xonar Essence STX) only goes down to 32KHz. So, cooked mode resamples the sound higher then 22KHz so I can get audio. I wish Goldsrc games could support 44.1KHz, so I wouldn't have to use "cooked mode" to resample the audio. I'm going to make an issue about this and see if they can add support for 44.1KHz audio.