-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add a project setting to configure the audio resampling algorithm #2298
Comments
Maybe the resampling algorithm needs improvement? It should be possible to have a one-size-fits-all resampling algorithm. In Unity, audio assets are resampled quite well, and I don't choose any options for this.
EDIT: this is the hardcoded algorithm? |
This proposal is effectively stating that there is no "one size fits all" resampler. It all depends on your needs, performance constraints and even personal preference 🙂
AudioRBResampler only seems to be used within VideoPlayer. The AudioStreamPlayer nodes have their own resamplers (linear for WAV, "4 point, 4th order optimal" for OGG and MP3). See #2299. |
So this proposal asks for an option to play an audio asset differently. Change an option to tweak the sound of the original asset. @Calinou Am I understanding this correctly?
Resampling algorithms are complex. I would advise against touching this if there is an alternative to achieve what you would like. |
Godot doesn't expose a way to configure the resampler; there is one one and it's hardcoded. However, I'm not sure if Unity and UE4 expose a way to change the resampling algorithm either. The option I'm proposing here is global to the project. It's not per-sample or per-audio bus. |
Can you elaborate on this? I don't understand this. Why would you want to distort all your audio assets? They should sound the same in-game as when you listen to them in your music player. |
This is about improving perceived sound quality for retro games. In my experience, sounds with a sample rate below 44.1 kHz will often sound better when using a low-quality resampler compared to a high-quality one. There are exceptions here and there, but this is what I noticed on my hardware at least. That said, reduz told me that he'd prefer users to modify the sounds in question in a DAW to resample them, then export the sounds in 44.1 kHz. This isn't ideal in terms of file size, but it's the simpler option in terms of engine implementation. Therefore, I'll close this proposal as it's unlikely to be implemented. |
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Godot's audio resampling algorithm is currently hardcoded and there is no way to change it.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
There are a few reasons to change the audio resampling algorithm used in a game:
Here's an example with Freedoom's shotgun sound played with nearest resampling, then cubic resampling, then 23th order sinc resampling:
freedoom_shotgun_sound_resampler_comparison.mp4
Of course, nothing prevents you from using nearest-neighbor resampling in your DAW then exporting the sample in 44 kHz or more, but doing so will increase file size. This can be a problem when targeting mobile/web platforms where distribution size needs to be kept as small as possible.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add a project setting to configure the audio resampling algorithm used by Godot. I think having an option to use nearest-neighbor resampling in addition to the default high-quality mode would be a good start already.
godotengine/godot#46086 is working on adding a new audio resampling mode which is of higher quality but also more demanding than the current cubic resampler. Therefore, we may need to keep the Cubic option available as well.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, as this resampling is done in C++ in the audio engine.
Is there a reason why this should be core and not an add-on in the asset library?
See above.
The text was updated successfully, but these errors were encountered: