Handling audio
No narrative game can exist without background music that creates the appropriate atmosphere or sound effects that underline certain actions. As well, speech is very often used to bring characters to life in such games.
All of this is supported by Escoria.
Note
Escoria supports all audio formats officially supported by Godot
Playing music and sound effects
Escoria features three built-in audio players which are accessible by their ESC global IDs:
_music
: Used for looping background music_sound
: Used for playing sound files_speech
: Used for voice support
Playing audio is done by using the play_snd ESC command. It expects the path to the specific audio resource to be played and the global ID of the desired audio player.
If the audio player is unspecified, it defaults to _sound
.
Examples
play_snd res://music/happy.ogg _music
Plays the background music
res://music/happy.ogg
play_snd res://sound/door_open.wav
Plays the sound effect
res://sound/door_open.wav
Note
Escoria takes care of the looping setting itself. Music is looped by default; sound effects are not.
You can stop the currently-playing audio using the stop_snd ESC command. It expects the global ID of the audio player as its only argument.
If the audio player is not specified, _music
is used as the default value.
Voice support
See the documentation about dialogs for more details on using voice files.