What kind of sound format does SamplePlayer support?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By KenHuang0917
:warning: Old Version Published before Godot 3 was released.

I can see that SamplePlayer can play .wav and .ogg files from demo examples. Is it capable of playing .m4a, .mp3, or .aif? Or anything else? (especially compressed format)

:bust_in_silhouette: Reply From: Calinou

NOTE: Information below is outdated and does not apply to Godot 3.0.


SamplePlayer

This one is intended for sound effects (weapons, pickups, …). It can only play .wav sounds, either uncompressed or using IMA-ADPCM compression (which is of relatively mediocre quality). There’s a request for .ogg samples too.

Note that shipping .wav samples within a game is usually not that bad for final file size, since it will usually be compressed using a ZIP compression algorithm when users download your game (for example, .apk uses compression, so do some .exe installers). You can also choose to export game data in .zip which is compressed, unlike the default .pck format.

StreamPlayer

This one is intended for music or ambience effects (sounds longer than 15-20 seconds, usually). It can play Ogg Vorbis and Opus formats (file extensions can be .ogg for either, though Opus is sometimes renamed to .opus).

Opus is one of the best lossy audio codecs currently, and it’s patent-free/royalty-free, but it uses more CPU to decode than Vorbis (which also is patent-free).

MP3 remains patented until 2018-01-01 (decoding and encoding; decoding-only is already patent-free since all the patents on MP3 decoding have expired). Until then, it is unlikely that support for this codec will be added to StreamPlayer.

Thank you for your detailed explanation !

KenHuang0917 | 2016-12-20 13:59