Skip to content

MusicPart ​

Inherits: Resource

A part of a Dynamic Music: one piece of music (a file) with its tempo, which a state plays. It can have layers (stems that play with it). Parts of different tempo switch at a bar line of the old part and start from the beginning of the new one. See docs: Audio > Dynamic Music.

Properties ​

Stringname""
Stringpath""
floatbpm120.0
intbeats_per_bar4
boollooptrue
Stringnext_part""
floatvolume_db0.0
Array[MusicLayer]layers[]

Methods ​

Stringdescribe()
PackedStringArrayget_paths()
PackedStringArrayvalidate()

Property descriptions ​

String name = "" ​

The name of the part ("Explore", "Boss phase 1"); states and transitions refer to it

String path = "" ​

The file of the part (an audio file of the library: Ogg or MP3, a WAV has no tempo)

float bpm = 120.0 ​

The tempo of the piece, in beats per minute. The transitions wait for the next beat or bar by it

int beats_per_bar = 4 ​

Beats in a bar (4 for 4/4, 3 for waltz time)

bool loop = true ​

The part plays again when it ends (on), or once (off: then the part named below follows, or the music ends)

String next_part = "" ​

When the part does not loop: the part that follows it (empty = the music ends and the music below takes over)

float volume_db = 0.0 ​

How loud the part is (dB)

Array[MusicLayer] layers = [] ​

Stems that play with the part and fade in and out with the intensity

Method descriptions ​

String describe() ​

The title of the part in the editor

PackedStringArray get_paths() ​

Every file of the part: the piece and its layers

PackedStringArray validate() ​

The warnings of this part