music_fade

When called in a stage article, gradually decreases or increases the background music to the target volume.

Both arguments are optional; by default the music will fade to silence. Once the music is fully silent, background music playback will be stopped.

ArgumentTypeDescription
volume:real(optional)
The target music volume, with a range of 0 to 1.
amount_per_frame:real(optional)
Determines how much the volume decrements or increments per frame, with a range of 0 to 1.

Example 1, called from a stage’s update.gml:

// fade to silence at a rate of 0.01 per frame:
music_fade();

Example 2, called from a stage’s update.gml:

// fade to 10% volume at a rate of 0.025 per frame:
music_fade( 0.1, 0.025 );