Skip to content

DynamicMusic ​

Inherits: DatabaseResource < Resource

Music that changes with the game: a set of parts (pieces of music with a tempo, optionally with layers), states (names the game asks for, each playing a part), transitions (how one state changes into another: when, where the new part starts, the fade, a bridge), and stingers (short sounds over the music). A world, a zone, a weather, an encounter or an event plays one through a SoundSource; an event or a boss phase changes its state, and the party's combat state switches to a state called Combat by itself. Needs Ogg or MP3 files (a WAV has no tempo). A database kind (Audio > Dynamic Music). See docs: Audio > Dynamic Music.

Properties ​

Array[MusicPart]parts[]
Array[MusicState]states[]
Array[MusicTransition]transitions[]
MusicTransitiondefault_transitionMusicTransition.new()
Array[MusicStinger]stingers[]
Stringstart_state""
floatvolume_db0.0
floatintensity_fade_seconds1.5
floatstart_intensity0.0

Methods ​

MusicPartget_part( part_name: String )
MusicStateget_state( state_name: String )
MusicStatefind_state_ignoring_case( state_name: String )
MusicStingerget_stinger( stinger_name: String )
Stringresolve_start_state( asked: String = "" )
MusicTransitionfind_transition( from: String, to: String )
PackedStringArrayget_part_names()
PackedStringArrayget_state_names()
PackedStringArrayget_paths()
PackedStringArrayvalidate()

Property descriptions ​

Array[MusicPart] parts = [] ​

The pieces of music

Array[MusicState] states = [] ​

The states the game can ask for

Array[MusicTransition] transitions = [] ​

The rules for changing from one state to another (the most specific rule that fits wins)

MusicTransition default_transition = MusicTransition.new() ​

The rule for a change that no rule above fits

Array[MusicStinger] stingers = [] ​

Short sounds that play over the music

String start_state = "" ​

The state the music starts in when its source does not name one

float volume_db = 0.0 ​

How loud the music is (dB)

float intensity_fade_seconds = 1.5 ​

The seconds the layers take to fade in and out when the intensity changes

float start_intensity = 0.0 ​

The intensity (0 to 1) the music starts with, which decides what layers play

Method descriptions ​

MusicPart get_part( part_name: String ) ​

No description yet.

MusicState get_state( state_name: String ) ​

No description yet.

MusicState find_state_ignoring_case( state_name: String ) ​

The state called this, ignoring case (the Combat state the party's fight asks for)

MusicStinger get_stinger( stinger_name: String ) ​

No description yet.

String resolve_start_state( asked: String = "" ) ​

The state the music starts in: the one asked for, else its own start state, else the first state

MusicTransition find_transition( from: String, to: String ) ​

The rule for changing from one state to another: the most specific that fits, else the default

PackedStringArray get_part_names() ​

No description yet.

PackedStringArray get_state_names() ​

No description yet.

PackedStringArray get_paths() ​

Every file the music can play (the parts, their layers and the stingers): what the world preloads

PackedStringArray validate() ​

The warnings of this music (shown by the editor)