Godot Web Audio Engine

Interactive music can turn an average game into a refined one — an immersive audio experience captures the player much more than simple loops that don’t follow the events in the game. Imagine an RTS that the moment you get attacked plays the same sombre music as when you are harvesting resources, or when you have won. So dull and disorienting! 

The simplest kind of interactivity is horizontal, where cues are triggered in time one after the other, to create a seamless soundtrack with perhaps different tensions and different colours, depending on the situation the player is in.

To create this kind of interactivity, there are useful pieces of software called middleware (FMod and WWise are the most famous) that facilitate the creation of interactive music, among other functions.

Not always though it is convenient to use these middleware solutions: they can add up considerably to the codebase, they can be overkill for simple projects, they may not support the platform for the game; in my case, it was the latter that pushed me to write this little engine.

For a game jam, my team had decided to use the Godot game engine, which I never had the pleasure to use. They also wanted the game to be playable on a browser, but the WWise integration for Godot didn’t allow for web exports.

I a days worth of work, I managed to write a simple, highly customisable audio engine for Godot that would work on browser.

The manager is ~150 lines of code, and you can see it well commented here on GitHub.


Also, thanks to Ravenmore for providing the UI