-
Notifications
You must be signed in to change notification settings - Fork 40
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
use SDL_AudioCVT to convert sfx lumps #858
Comments
I like this idea, another dependency is not a big issue since we finally have a proper package/dependency manager for all builds.
The WAV format is complex, so we only support a small part of it. I'm sure there are WADs with broken WAV files somewhere (by the way, GZDoom uses libsndfile). I also suggest using libsamplerate, maybe that way we get rid of the remaining click sounds. Although, there is a user who liked the current resampler. |
I also like our current resampler! (That is, the way it sounds, not the way it works 😁) However, I seem to be unable to find the code in libsndfile that is responsible for resampling. 🤷 (I'd like to see how far we come without libsamplerate) |
Hm, libsamplerate only works with floats, so we need to convert the original 11kHz/U8 samples to 11kHz/F32 to feed them into libsamplerate, get them converted to 48kHz/F32 and then convert them back to 48kHz/S16 to please SDL2_Mixer. |
So, it seems that while libsndfile is indeed able to convert the sound lump samples from U8 to S16 format (which is pretty much what this library is supposed to do), it is not able to do the samplerate conversion for us - which is okay since this is exactly what libsamplerate is for. But neither library seems to be able to do the mono to stereo conversion for us. So, in the end we'd still have to do some manual conversion of the sound samples. And if we can't get rid of it entirely, we could just as well keep our current approach of doing all steps manually. Either this, or we link against a more powerful library (libsox?) that can do the whole necessary conversion chain for us. |
It seems SDL2 already uses libsamplerate: microsoft/vcpkg#28554 It can also be built on Windows with this feature. https://wiki.libsdl.org/SDL2/SDL_ConvertAudio |
Oh, that's new then. Chocolate Doom for example still holds the assumption that SDL2_Mixer can only do integer ratio conversions itself. |
Indeed:
I'll try to convert all sound samples using only SDL functions instead! |
Pros:
Cons:
Neutrals:
The text was updated successfully, but these errors were encountered: