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

[Feature request] OpenAL Soft #480

Open
markanini opened this issue Jun 3, 2022 · 10 comments
Open

[Feature request] OpenAL Soft #480

markanini opened this issue Jun 3, 2022 · 10 comments
Labels

Comments

@markanini
Copy link

markanini commented Jun 3, 2022

Any chance of implementing this? The current audio capabilities inherited from QS have some issues.

  1. Handling of mixed sample rates is not optimal. You can only configure it in two ways, to down-sample(default), which mutes the top end of all EDIT:some sounds, or up-sample with very audible aliasing distortion.

  2. Makes surround audio over normal headphones possible, which is a pretty good fit for Quakes gameplay. Here's an example if you want to see what it's about: https://youtu.be/rc5a7dzRvbY?t=25

@Novum
Copy link
Owner

Novum commented Jun 3, 2022

Is the resampling algorithm bad or what's the concrete issue? Proper resampling does not cause aliasing, nor does it "mute the top ends" as long as the target sample rate is above ~40kHz.

@Novum
Copy link
Owner

Novum commented Jun 3, 2022

@markanini
Copy link
Author

markanini commented Jun 4, 2022

Purely empirically, changing sndspeed from default 11025 to 44100, it should sound the same if high quality filtering is used. Reason being that the majority of Quake sounds are natively 11025 Hz. Instead it gets brighter which suggests aliasing from a lack of filtering.

Further evidence that something is wrong is the snd_filteringquality having no effect between 1-5 unless sndspeed is at default 11025.

Proper resampling does not cause aliasing, nor does it "mute the top ends" as long as the target sample rate is above ~40kHz.

Agreed. The default setting down samples a small amount of Quake sounds that re natively in 22050Hz, thus muting the top octave.

@ericwa
Copy link
Collaborator

ericwa commented Jun 4, 2022

Further evidence that something is wrong is the snd_filteringquality having no effect between 1-5 unless sndspeed is at default 11025.

Yeah - QS has an internal resampler/lowpass filter after SFX mixing and before the music is mixed in, and it's only implemented for 11025 -> 44100 Hz resampling (so, ~5kHz lowpass). The goal was to emulate the sound of the original game running at the original's default rate of 11025 mixing, but be able to mix in the music before sending the sound to SDL.

https://github.com/Novum/vkQuake/blob/master/Quake/snd_mix.c#L240

(The implementation is a bit weird/inefficient because sounds are loaded at 44100 with nearest filtering, mixed at 44100, then lowpass filtered to 5kHz at the end, before the music is mixed in. Ideally they'd be loaded at 11025 - that would require good-quality resampler than can downsample anything to 11025, mixed at 11025, and then up sampled to 44100 at the end for mixing in the music. AFAIK, the output would be the same as what we have now, though.)

Agreed. The default setting down samples a small amount of Quake sounds that re natively in 22050Hz, thus muting the top octave.

This is true, but I would caution against changing the default mixing rate from 11025 because it'll make the game sound different than vanilla. (e.g. the Quake SFX mix can have a lot of clipping which is not as objectionable sounding at 11025Hz, but annoying at higher sample rates. Two other problems: the hard cutoff when the mixer stops a sound part way through (e.g. firing the nailgun does this a lot) is more annoying at sample rates >11025Hz, and some looping sounds sound OK at 11025Hz but they'll have audible glitches at the loop points if you upsample before looping.)

So I guess the concrete issue is, if you change sndspeed from the default of 11025, the QS code falls back to a nearest resampler before mixing in the music.

@Novum
Copy link
Owner

Novum commented Jun 5, 2022

I'm pretty sure I don't want to implement OpenAL specifically, but there seems to be some questions open regarding sound, so I'll keep this open for now.

@Novum Novum added the question label Jun 5, 2022
@markanini
Copy link
Author

So I guess the concrete issue is, if you change sndspeed from the default of 11025, the QS code falls back to a nearest resampler before mixing in the music.

Maybe a new cvar could be considered that removes that limitation, or emulation of original behavior, call it what you want. I think that would make some people happy that combine custom sounds with the stock ones also.

@RavenMacDaddy
Copy link

RavenMacDaddy commented Jul 12, 2022

Just for additional context, indeed increasing the sndspeed to 44.1 with the original PAKs is frankly a horrible SFX experience - however - using the same with the remastered audio from the rerelease PAK, which does have 44.1KHz somewhat in mind, works well enough overall.

Not sure if this plays a role specifically for this question, but still something interesting to bring up.

I too am a big fan of the ability to do some high-quality Cubic filtering, which OpenAL Soft allows.

I use DSOAL for all games that use DirectSound, specifically for that capability.

@Novum
Copy link
Owner

Novum commented Jul 12, 2022

SDL2 does high quality filtering, I already established that.

@markanini
Copy link
Author

SDL2 does high quality filtering, I already established that.

Indeed. It's not fully used though.

@LethalManBoob
Copy link

i figure people would argue for openal soft due to binaural hrtf

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

5 participants