Allow configuring audio latency with an env variable#6724
Open
rszyma wants to merge 5 commits intoppy:masterfrom
Open
Allow configuring audio latency with an env variable#6724rszyma wants to merge 5 commits intoppy:masterfrom
rszyma wants to merge 5 commits intoppy:masterfrom
Conversation
Author
|
It seems like this is primarily useful when NOT routing audio through pipewire. With pipewire it appears that pipewire settings But when selecting a raw ALSA device output in osu settings there seems to be no other way to control period_size/buffer_size than with BASS_CONFIG_DEV_PERIOD/BASS_CONFIG_DEV_BUFFER. That's why this needs to be configurable. |
35b32e5 to
fc799a5
Compare
It should behave like before, but now allows configuring the latency through OSU_BASS_CONFIG_DEV_PERIOD env variable (in milliseconds) examples: OSU_BASS_CONFIG_DEV_PERIOD=10 -> 441 period size in samples (default) OSU_BASS_CONFIG_DEV_PERIOD=2 -> 88 period size in samples
fc799a5 to
3c68278
Compare
Bass supports negative values in BASS_CONFIG_DEV_PERIOD, now we correctly handle this case. For example, using -256 will now correctly set the period to 256 samples and the buffer to 512 samples. Some hardware might work better with power-of-2 sample rates.
Contributor
|
I think we can probably do this, overhead seems small. |
smoogipoo
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows setting latency below currently unchangeable 20 ms audio device buffer by setting an environment variable
OSU_BASS_CONFIG_DEV_PERIOD.Resolves #6647
Previously there was an attempt at a similar change in #4008, except it tried adding in-game settings. From my understanding it didn't work out because we don't want casual users to have access game-breaking settings. It makes sense.
Environment variable on the other hand is less visible, and usually noobs won't be able to just set it mindlessly and break their game lol.
Tested in osu on Linux + ALSA exclusive mode, per instructions in this comment.
I have not tested on other platforms (sorry! please someone else do)
Before (raw ALSA device):
After (raw ALSA device +
OSU_BASS_CONFIG_DEV_PERIOD=2):Value of
10(ms for period_size, 20ms for buffer_size) is the default currently for raw ALSA devices output for me on Linux running the latest tachyon release (2026.318.0-tachyon).I can set as low as
2on my machine but1does chop terribly.I run RT kernel FWIW. This will vary for on different hardware of course.
Edit: with the lastest commit, by setting
OSU_BASS_CONFIG_DEV_PERIOD=-64I can lower it even more toperiod_size=64, buffer_size=128.Edit 2: real measurements here: #6647 (comment)