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_ambient: Used for continuous background/atmospheric sounds
Playing audio is done by using the play_snd ASHES command. It expects the path to the specific audio resource to be played and the global ID of the desired audio player.
If no audio player is specified for play_snd, it defaults to _sound.
Examples
play_snd("res://music/happy.ogg", "_music")Plays the file
res://music/happy.oggas background music.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 ASHES command. It expects the global ID of the audio player as its only argument.
If no audio player is specified for stop_snd, _music is used as the default value.
Voice support
See the documentation about dialogs for more details on using voice files.