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

Perfectly resample sound effects to the native sampling rate #50

Open
nmlgc opened this issue Aug 29, 2023 · 0 comments
Open

Perfectly resample sound effects to the native sampling rate #50

nmlgc opened this issue Aug 29, 2023 · 0 comments
Labels
Enhancement New feature or request

Comments

@nmlgc
Copy link
Owner

nmlgc commented Aug 29, 2023

The original DirectSound backend uses what seems to be a first-order low-pass filter when resampling the original sound effects to the native sampling rate. This adds a bunch of high-frequency content, which looks like this at 48000 Hz:

Frequency spectrum of all of Shuusou Gyoku's sound effects, resampled to 48000 Hz and recorded through the game's original DirectSound backend

For the miniaudio backend implemented in #49, I went for a first-order low-pass filter as well. That gets quite close possible to the original DirectSound spectrum, and only adds a slight bit of additional crispiness to the high end:

Frequency spectrum of all of Shuusou Gyoku's sound effects resampled to 48000 Hz, as rendered by the future miniaudio-based backend. Shows off the slight additional high-frequency content added by miniaudio's resampler in comparison to the original DirectSound backend.

However, some might argue that both are incorrect. If the original sound effects use sampling rates of 22050 Hz and 11025 Hz, shouldn't the spectrum look more like this?

Frequency spectrum of all of Shuusou Gyoku's sound effects if they were perfectly resampled

This issue would deploy such a perfect resampler into the game, and add a toggle to the sound option menu for switching between accurate and crispy modes. Since the crispy mode is closer to what the game originally sounded like (and also sounds a lot better in my opinion), this feature is highly optional, and pretty much only meant for people who strictly define "accurate sound playback" as "not adding any frequency content that wasn't present in the original files".

@nmlgc nmlgc added the Enhancement New feature or request label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant