What audio formats are supported by Raylib?

Today I learnt …

A couple of weeks ago a friend convinced me, without much difficulty as it happens, that making games in Go and Raylib is an enjoyable way to spend your free time. I started off by recreating that stalwart of the 1970s, Pong.

Raylib’s documentation is as minimal as it gets. There’s a dense cheatsheet and a suggestion that if you want to learn you should read the code. And so, when I wanted to add some sound to the game, these were the first places I went to find out which audio formats are supported. The cheatsheet wasn’t much use: it simply tells you that you can load sound from a file using LoadSound, or load wave data from LoadSoundFromWave. So off to GitHub I went.

From there it was pretty easy to discover what’s available. In src/config.h there are some configuration flags that hint at the supported audio formats:

Raylib supports the first six by default, but support for FLAC isn’t included unless you compile it in yourself. If you want it, you’ll need a customised build with the SUPPORT_FILEFORMAT_FLAC flag turned on. Try to play a FLAC file without it and Raylib will log an error:

WARNING: WAVE: Data format not supported

Of course, after all that I discovered that this is briefly documented in the FAQ and in the raudio module README. Today I learnt that if someone promises minimal documentation, you shouldn’t take their word for it.