Good day, I have a question. And this is probably not something a beginner should do but I want to ask anyway.

My project uses a wide variety of audio types, for what reason is something I would not disclose. But the point is that I want it to be able to use MP3, WAV, OGG and the likes. But there is one that my project uses a lot -- and it would be OPUS.

When I was looking through the Godot documentations, especially the past ones, I noticed it used to support it back in Godot 2, but nothing after that. My question is: how do I implement custom Audio types such as OPUS?

Obviously, the answer would be to implement a plugin or fetch it off some GitHub but I want to know what you would personally do if the aforementioned fails.

    Hi,

    I am not very experienced with audio, but is there any feature that OPUS encoding have you can't have with any other supported encoding? Can't just convert OPUS files to some supported format and then import to Godot? That would be the easiest way I think, because unless you have much experience with low level audio processing adding new codec support may be not so easy and take a lot of time figuring things out.

    If you really need to add direct support for OPUS I would start with checking OPUS codec library doc and probably you need to implement new module (maybe also possible with GDExtension) implementing something like AudioStreamPlaybackOPUS and AudioStreamOPUS and add import support so Godot knows it should be used for OPUS files. For that I would base on some already implemented audio type like MP3 for example?

      GlyphTheWolf For that I would base on some already implemented audio type like MP3 for example?

      Opus was supposed to have better quality than MP3. But in reality, its benefits were questionable.

        GlyphTheWolf I am not very experienced with audio, but is there any feature that OPUS encoding have you can't have with any other supported encoding?

        It is really desirable for me to have it on OPUS solely because of its high quality audio and small size. Assuming I have a hundred OPUS music files that are 4 minutes in length, it would at least be 50-65% lower in size compared to its MP3 counterpart.

        But thank you for the idea, I will attempt to do so.

        • xyz replied to this.

          Yuzurukyun I want to know what you would personally do if the aforementioned fails.

          There's open source code for a converter somewhere, possibly here: https://opus-codec.org. To hook it into Godot, it might be necessary to use C or C++, which you can do using GDNative (Godot 3) or GDExtension (Godot 4).

          Tomcat

          I get better compression from any of the standards produced after mp3, with similar quality. But, mp3 is still pretty good. 🙂