Skip to content

Add support for QOA (Quite OK Audio) format #9133

Description

@DeeJayLSP

Related to #1144, #4264, #7599 and godotengine/godot#80160.

Describe the project you are working on

Game with sound effects.

Describe the problem or limitation you are having in your project

The options we currently have on the engine for sound effects are:

  • WAV 16-bit: loses on size;
  • Vorbis and MP3: loses on decoding speed, making it not viable for lots of sound effects playing at the same time;
  • WAV IMA-ADPCM: loses drastically on quality;

ADPCM-XQ somewhat makes IMA-ADPCM better, but the resulting audio will still have noticeable artifacts;

About the same "problem or limitation" as #7599 (ADPCM-XQ proposal).

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add support for the Quite OK Audio Format (QOA).

When it comes to characteristics above:

  • Size: smaller than IMA-ADPCM (3.2 bits vs 4 bits);
  • Decoding speed: about the same as IMA-ADPCM;
  • Quality: while it somewhat loses to MP3 and Vorbis (mostly due to a noise that's also somewhat present in ADPCM-XQ, it's still much better than IMA-ADPCM;

This makes it an ideal lossy compressed format for sound effects.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Approach 1: QOA file importing

Users would be able to import QOA files like they would do with WAV, MP3 and Ogg.
One problem with this approach however is that no common software nowadays have support for exporting files as QOA, and there's little interest in implementing it. At the time of this writing, FFmpeg has only implemented a decoder.

Approach 2: Import WAVs as QOA

Enable a Quite OK Audio importer on the Import As dropdown for WAVs:

image

It's an implementation of a built-in converter. This way, an user could work with WAVs within the game files, but internally it will be imported as QOA.

Approach 3: QOA as a WAV compression mode

This one was added months after the proposal was created, as I found it to be possible.

Add QOA as a WAV compression mode:

image

There is a bit of resistance when it comes to implementing encoders inside Godot, but for QOA I believe it makes sense since QOA conversion isn't supported by major file converters and there's little interest on it

Approaches 1 and 2 have been used in a custom working module I made (the screenshot above is from it).
It adds around 8kB into release template file size, but this gets mitigated as long as at least 0.06-0.13s of WAV audio gets QOA'd.

Approach 3, on the other hand, only had a binary size increase of 32 bytes.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Unlikely.

Is there a reason why this should be core and not an add-on in the asset library?

In the case of Approach 3 and considering there's some support for it, I don't think an importer with negligible size penalty meant for compression should be an addon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions