Skip to main content

Overview

Godot’s Interactive Music system allows you to create dynamic, adaptive music that responds to gameplay. The AudioStreamInteractive module provides tools for seamless transitions, layering, and synchronized playback of multiple music tracks.
Interactive music is part of the modules/interactive_music/ module and provides advanced features for game music implementation.

AudioStreamInteractive

The AudioStreamInteractive class enables complex music systems with multiple clips that can transition between each other based on game state.

Basic Setup

Transition Modes

Control how and when music transitions occur:

Immediate Transitions

Beat-Synchronized Transitions

Bar-Synchronized Transitions

End-of-Clip Transitions

Bar-synchronized transitions are ideal for maintaining musical timing and avoiding jarring changes.

Music Layering

Create layered music that adds or removes instruments based on intensity:

Triggering Transitions

Change music based on gameplay events:

AudioStreamPlaylist

For simpler sequential playback:

AudioStreamSynchronized

Synchronize multiple audio streams to play together:

BPM and Bar Synchronization

Set timing information for proper synchronization:
Ensure your audio files are properly trimmed to exact bar/beat lengths for seamless looping and transitions.

Advanced Techniques

Vertical Remixing

Dynamically enable/disable layers based on game intensity:

Horizontal Re-sequencing

Change sections based on player progress:

Best Practices

Export stems/layers at the same BPM with exact bar lengths for perfect synchronization.
Choose TRANSITION_FROM_BAR for musical transitions, TRANSITION_FROM_END for intros, and TRANSITION_IMMEDIATE only when necessary.
Play through all possible transition combinations to ensure they sound good.
Interactive music loads multiple clips. Use compressed formats (OGG) for longer tracks.
Always have a graceful musical state to return to if unexpected events occur.

See Also

Audio Overview

Learn about AudioServer and basic playback

Audio Streams

Understand audio formats and stream types

Audio Effects

Apply effects to enhance your music