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
Remove low-quality/limited IMA-ADPCM compression from the WAV importer #4264
Comments
|
IMA ADPCM is super cheap to decode and resample, orders of magnitude more than mp3 or ogg. Not a good idea to remove. You can have hundreds of these decoding at no cost. |
|
I think a better idea is to just improve/fix/replace the encoder & decoder all together. No (or significantly less) compatibility breaking here. For some reason Godot's encoder (atleast in versions up to and including 3.4.4) in my experience produces results ranging from fine/acceptable, to "this literally sounds like the file was corrupted in export." Some sampling rates tend to sound 8 times worse than they should too (I.E. 32khz sounds much more like 16khz to me). If you export a file with IMA-ADPCM from Audacity, and compare it to a file encoded via Godot, the file from Audacity is going to sound much better. I've included a sample project (using a voice line from Half-Life 2 if that's ok) which shows what I'm talking about (although believe it or not, this is one the less egregious instances I've encountered. If I find a sound that causes this, I'll share it). At the start of the IMA-ADPCM encoded sounds there is some very obvious popping. I've also included some files exported from Audacity to show how the files encoded by Godot should probably sound much more like. I am also wondering if it might be a good idea to basically just use a different ADPCM format altogether (maybe even a custom one lol). |
|
reduz recently suggested that we look into adding support for FLAC decoding. This would provide the same quality as uncompressed WAV, but with smaller file sizes. This would also benefit games that can load user-provided music (as FLAC has been increasingly replacing MP3 in people's local music libraries). There's a BSD0-licensed library for it: https://github.com/jprjr/miniflac I don't know how much CPU FLAC decoding requires though – probably more than IMA-ADPCM, but maybe less than Ogg Vorbis? |
|
Note that lossy WAV is an alternative that can be explored if Ogg Vorbis or even MP3 decoding are too expensive in your project. It's compatible with any program that can read WAV files, without requiring dedicated support. |
I just thought it might be because the audio is unfiltered, and that's indeed the case. The encoding is fine, it's a bug. Anyways, sorry for rambling, my final comment is that this leads to a slightly cleaner sound when max rate is set to 24khz than off. |
|
If FLAC import was added, I'd use that instead of WAV just to save space in the game repository. |
|
@unfa I posted godotengine/godot#80160 pull request for FLAC import. |
Related to #1144.
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Godot supports several audio formats:
WAV supports lossy compression via IMA-ADPCM, which is a compression technique originally developed in the 1970s:
Unfortunately, this compression is considered very low-quality by today's standards, with Ogg Vorbis or even MP3 performing significantly better in terms of quality. Unlike Ogg Vorbis and MP3, IMA-ADPCM compression also doesn't offer any way to balance between file size and quality with a bitrate control.
In Godot, IMA-ADPCM compression also doesn't support playing audio from a given position.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Remove the IMA-ADPCM encoder and its associated import option in the WAV import dock, but keep the IMA-ADPCM decoder for run-time WAV loading once it's implemented. There are still WAV files out there with IMA-ADPCM compression, and loading those should remain supported.
Any CPU released in the last 12 years can decode several Ogg Vorbis or MP3 streams at the same time (even on mobile), so IMA-ADPCM's comparatively faster decoding speed is not relevant anymore.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Projects upgrading from Godot 3.x will still be able to use WAV files (including IMA-ADPCM compressed ones). However, if the Compression option was enabled and the original WAV files are uncompressed, those files will no longer be imported with compression enabled.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
This is about removing an option from a core importer.
This proposal is about avoiding "footguns" in terms of audio quality, by steering users towards higher quality audio compression options when needed.
The text was updated successfully, but these errors were encountered: