itch.io is community of indie game creators and players

Devlogs

How we handle audio

Little Shadow
A browser game made in HTML5

This 82th Godot Wild Jam was my fourth with Tilca, our composer and sound designer, and I must admit we progressed a lot on the audio side since Celestial Settlers.

In our first gamejam projects, we just did things in the most natural way when using Godot: add AudioStreamPlayer3Ds wherever sound had to happen. But this makes it necessary for the sound designer, either to navigate the whole project to add sounds and tweak volumes, or to team up with a developer (or the developper, in a small gamejam team) for doing so.

Starting with Lord of the Rum, I wrote a few scripts that make it possible to:

  • declare all sounds and their associated volumes in a dictionary
  • play any sound (using its key in the table) in any Node3D. This just allocates an AudioStreamPlayer3D, places it inside the Node3D, and plays the sound. When the sound is finished, the audio stream player is removed from the scene tree and stored in a pool.

At that point we had a working solution and used it as is for Little Shadow. But the number of sounds increased significantly, and we decided that organizing sounds in a tree structure would be a lot more convenient.

So I rewrote the user interface so sounds can be declared in a tree view and configured easily (bus, volume, pitch shift, volume randomness, attenuation parameters) by the sound designer. All this in a new panel named TRAudio (Tilca and Rod's Audio plugin).

And on the developer's side, quite a few ways of playing sounds by name are available:

  • Just programmatically: TRAudio.play_sound("sfx/player/footstep")
    This method has (of course) 2D and 3D counterparts and automatically allocates audio stream players when needed and inserts them in the node tree.
  • By using a TRAudioStreamPlayer (or 2D or 3D versions) and calling the play_sound method. This method is similar to "standard" Godot usage, so it's an easy way to update an old Godot project. It is also  well suited if you want to trigger sounds in an animation: just replace the audio playback tracks with method call tracks, and call the "play sound" method to play a sound.
  • By using a TRSoundPlayer, that is a mix between both solutions above: allocates audio stream players when needed, but anchored in the node tree, so they can be driven by an animation. Since they allocate audio stream players, they can play several sounds simultaneously.

So this is what we used in Little Shadow and Delicious Neighbors, and now we saved a lot of time using all this, it's time for us to share. You will find the TRAudio add-on for Godot on Github, under the MIT License. Please don't hesitate to contact us if you need help using it (it's the very first version, and documentation is probably not as complete as it could).

Download Little Shadow
Read comments (6)