This plugin manages volume levels for your entire game. It also centrally controls music for gameplay and a pause menu. It has functionality for fading music in and out, cross-fading music, displaying song and album info (for Ogg Vorbius and some Wav files), and playing UI sounds, and playing dialogue.
For use with Godot 4.6.stable and later.
The following dependencies are included in the addons folder and are required for the template to function.
- Copy the
dragonforge_soundfolder from theaddonsfolder into your project'saddonsfolder. - If it does not exist already, copy the
dragonforge_diskfolder from theaddonsfolder into your project'saddonsfolder. - If it does not exist already, copy the
dragonforge_user_interfacefolder from theaddonsfolder into your project'saddonsfolder. - Go to Project -> Project Settings...
- Select the plugins tab.
- Check the On checkbox under Enabled for Dragonforge Disk (must be enabled before the Sound plugin or you will get errors).
- Check the On checkbox under Enabled for Dragonforge User Interface.
- Check the On checkbox under Enabled for Dragonforge Sound.
- Press the Close button.
- Save your project.
NOTE: As of version 0.17, the plugin no longer adds the buses it needs. If you have an old version of the plugin, load the defaults and manually create the buses you need.
Out of the box, this plugin has an Audio screen that supports volume controls for Main (Master Bus), Music, SFX, and Dialogue buses. However, due to a bug with Godot, you must create these buses yourself for now. If you're not using Dialogue, you do not need to make a Dialogue bus, but it is recommended you make the other three.
- Click the Audio tab at the bottom of the editor.
- Click the Add Bus button, and name the new bus "SFX".
- Click the Add Bus button, and name the new bus "UI".
- Click the Add Bus button, and name the new bus Music.
NOTE: Any buses you do not create will result in Sound and/or Music using the Master bus instead. Also, those volume controls will be missing from Audio screen as you cannot configure their volume controls seperately without separate audio buses.
volume_changed(audio_bus: String, new_value: float)Emitted when the volume for a bus is changed.
enable_3d_look = falseWhen true, 3D look is on for the game. The right stick will look, as well as the mouse. In addition the mouse will be captured when the game is playing and freed when the game is paused. Defaults tofalse(off).
ui_sounds: UISoundsStores custom sounds for the UI Player that can be saved to a resource.
get_sound(sound_name: StringName) -> AudioStreamReturns the [AudioStream] from [member ui_sounds] that matches [param sound_name]. Returns null if nothing is found.play_ui_sound(stream: AudioStream) -> voidPlays an [AudioStream] through the UI Sound Player which is always active.play_volume_confirm_sound(bus_name: String = "Master") -> voidPlays the default volume confirm sound therough the passed bus. Used for confirming volume changes in the Audio settings menu.play_dialogue(stream: AudioStream) -> voidPlays an [AudioStream] through the Dialogue Player which is always active.set_bus_volume(bus: String, new_value: float) -> voidSets the volume of the given bus using the float for the volume from 0.0 (off) to 1.0 (full volume). Also stores the value in the settings file.get_bus_volume(bus: String) -> floatReturns the volume for the bus passed as a float from 0.0 (off) to 1.0 (full volume).
The Music system has been separated from the Sound system to facilitate easier coding. It allows the fading of music in and out, as well as cross-fading of music, and supports a game music player and a pause menu music player that automatically switch on and off when the game is paused or unpaused using get_tree().paused.
signal song_startedEmitted when a new song starts.signal song_stoppedEmitted when a song is stopped.signal song_finishedEmitted when a song is not looped and finishes without being stopped externally.signal pause_song_finishedEmitted when the pause menu song is not looped and finishes without being stopped externally.signal fade_out_finishedEmitted when a song is faded out, and the fade out finishes.
enum Fade {
## Not intended to be used, but will function the same as NONE.
DEFAULT = 0,
## No fading. The current song (if any) is stopped and this one is started.
NONE = 1,
## The previous song (if any) is stopped, and this one fades in.
IN = 2,
## The previous song fades out and this one is started from the beginning after the fade is complete.
OUT = 3,
## The previous song fades out while this song fades in over the fade_time.
CROSS = 4,
## The previous song (if any) fades out completely first using the fade_time, then this song fades in over the fade_time.
OUT_THEN_IN = 5
}
play(stream: AudioStream, fade: Fade = Fade.NONE, fade_time: float = DEFAULT_FADE_TIME) -> voidPlays an AudioStream through the music channel. If a Song resource is passed, the Song's own play() method is called (which calls this method with the embedded AudioStream and sends out the now_playing signal.) Fading uses the value passed. (Default is NONE.)stop(fade: Fade = Fade.NONE, fade_time: float = DEFAULT_FADE_TIME) -> voidStops the currently playing song. If fade_out is true, it fades out the currently playing song over the fade_time passed (default is 2 seconds).pause() -> floatPauses the currently playing music. Returns the playback position where the stream was paused as a float.unpause() -> voidUnpauses the currently queued music.is_paused() -> boolReturns whether or not music is currently paused.is_playing() -> boolReturns whether or not music is currently playing.fade_in(audio_stream_player: AudioStreamPlayer, audio_stream: AudioStream = null, fade_time: float = DEFAULT_FADE_TIME) -> voidFades the [param audio_stream] in using the [param audio_stream_player] [AudioStreamPlayer] and the [param fade_time]. If no [param audio_stream] is given or [null] is passed, it is assumed that value was already set outside this function.fade_out(audio_stream_player: AudioStreamPlayer, fade_time: float = DEFAULT_FADE_TIME) -> voidFades out the currently playing stream on the [param audio_stream_player] [AudioStreamPlayer] using the [param fade_time]. Once the player is stopped, the volume is set to the default level for the passed [AudioStreamPlayer]'s bus.cross_fade(audio_stream_player: AudioStreamPlayer, audio_stream: AudioStream, fade_time: float = DEFAULT_FADE_TIME) -> voidCross fades the [param audio_stream] in while fading the existing stream playing in the [param audio_stream_player] [AudioStreamPlayer] using the [param fade_time].get_song_info_bbcode() -> StringReturns the title, artist and album for the currently playing song if they are stored in the metadata of the song and the stream is of type [AudioStreamOggVorbis] or [AudioStreamWAV]. NOTE: [AudioStreamMP3] is not supported by Godot at this time.
As of version 0.10, the Music player has two players - one for when the game is playing, and one for when the game is paused (e.g. get_tree().is_paused()). If a song is set when the game is paused, that song with be played and paused whenever the game is in a paused state. Likewise it can only be stopped when the game is in a paused state. Similarily, a song playing in the game will pause when the game is paused, and resume when the game is unpaused.
This was implemented due to issues trying to maintain and switch two different songs between the states. You do not have to do anything for this feature to work. It just does.
A resource to retrieve song information more easily.
stream: AudioStreamThe [AudioStream] information is pulled from, if it exists.title: StringThe song's title. If metadata is not set, or the [AudioStream] does not support reading tags, a humanized version of the filename is used.artist: StringThe song's artist, or alternately, album_artist, if either metadata is set. It is recommended to use [AudioStreamOggVorbis] for this feature.album: StringThe song's album, if the metadata is set. It is recommended to use [AudioStreamOggVorbis] for this feature.
get_song_info_as_bbcode(title_color: Color = Color.WHITE, artist_color: Color = Color.WHITE, album_color: Color = Color.WHITE) -> StringReturns the title, artist and album for the currently playing song as BBCode if they are stored in the metadata of the song and the stream is of type [AudioStreamOggVorbis] or [AudioStreamWAV]. Otherwise just returns the song title based on the name of the file. If [Color] values are passed for title, artist, or album they will be used in the returend BBCode. Otherwise, they will default to white.get_song_info_as_text() -> StringReturns the title, artist and album for the currently playing song if they are stored in the metadata of the song and the stream is of type [AudioStreamOggVorbis] or [AudioStreamWAV]. Otherwise just returns the song title based on the name of the file.
A list of sounds that can be played. Stored in a resource that is local to the game so that it is easy to updated the Sound plugin and re-apply settings.
sounds: Dictionary[String, AudioStream]A list of sounds that can be played. Stored in a resource that is local to the game so that it is easy to updated the Sound plugin and re-apply settings.
get_sound(sound_name: String) -> AudioStreamRetrieve an AudioStream stored under the given name.
Icons provided by SVG Repo.
The music in the test program was created and copyright by Dragonforge Development 2025.
Anvil Hit 7 from FilmCow Royalty Free Sound Effect Library by FilmCow Countdown (miscellaneous_8_karen.wav) from Super Dialogue Audio Pack by Dillon Becker
This project's UI has been created to work with localization. You can easily use localization by using the Dragonforge Localization plugin. The following labels exist and should be given translations:
- VOLUME
- MAIN
- MUSIC
- SOUND_EFFECTS
- DIALOGUE
- BACK