For Godot adaptive music with a Mowjera export, copy the audio files to res://audio/mowjera/, register Mowjera.gd as an autoload named Mowjera, then call Mowjera.change_state("Alarm") from any script. An autoload is a script Godot loads once and keeps available in every scene.
The authors of this guide have not tested these exports inside Godot. The steps follow the generated code, which is written for Godot 4.
Before you start
- Export your game music bundle and unzip it.
- Have a Godot 4 project open, and know how to edit a GDScript file.

Step 1: copy the files
- Create the folder
res://audio/mowjera/. - Copy every file from the zip's
audio/folder into it, keeping the names. - Copy
godot/Mowjera.gdinto your project.
Step 2: check the loop setting
The script switches each WAV to forward looping, but WAV files from the Export Bundle button contain no loop points. As a precaution, select each WAV in Godot, open the Import dock, set Edit > Loop Mode to Forward, leave Loop End at -1 (the end of the file), and reimport. These options are described in the Godot audio import guide.
Step 3: register the autoload
Open Project > Project Settings > Globals > Autoload. Choose Mowjera.gd, name it Mowjera, and add it. The Godot autoload guide shows this screen.
Step 4: play and change states
The examples use states named Unseen and Alarm. Your names are in the STATES list in the script.
extends Node
func _ready() -> void:
Mowjera.play_state("Unseen")
func on_player_spotted() -> void:
Mowjera.transition_mode = 0
Mowjera.fade_time = 0.5
Mowjera.change_state("Alarm")stop_all() stops the music. The signal state_changed(state_name) fires when the switch begins, which is useful for syncing visuals.
Which settings can you change?
| Name | What it does | Starting value |
|---|---|---|
fade_time | Seconds a crossfade takes | 2.0 |
transition_mode | 0 Immediate, 1 Next Bar, 2 Next Phrase (two bars) | 1 |
Set them from code, as in the example. A bar is a short group of beats.
Are your transition times applied automatically?
No. The timing and fade of each arrow in your score are saved in metadata.json, but the script does not read it. It uses the single transition_mode and fade_time above. Set them before each change. If you alter fade_time while a switch is still waiting for its bar, the new value is used. See game music transitions.
How do you control layers?
A bundle exported with Layer stems adds these:
Mowjera.set_intensity(0.7)
Mowjera.set_parameter("danger", 0.4)
var danger = Mowjera.get_parameter("danger")Values run from 0 to 1. Replace danger with a parameter id from the PARAM_NAMES list. The layered script also has master_volume, parameter_ramp (0.35 seconds) and the signal parameter_changed(param_name, value). A script exported without layers has none of these.
What you should hear
The first state loops. On change_state, it waits for the chosen point, then crossfades to the new state.
If something goes wrong
| Problem | Fix |
|---|---|
| "missing audio file" warning | Check the path res://audio/mowjera/ and the exact file names |
| A state plays once or stays silent | Redo the loop import setting for that WAV |
Mowjera is not recognised | Check the autoload name, spelled exactly Mowjera |
| "unknown state" warning | State names have no spaces, for example BossFight |
| Bar changes drift after pauses or stutters | The script counts bars with the system clock from play_state. Call play_state again to restart the count, or use mode 0 |
What to try next
Learn how stems are chosen in intensity layers and parameters, or see the Unity version.