Audio
Music, ambient loops, sound effects and voice lines — and when each one is heard.
The audio app triggers. All of them take assets resolved through chat.scenario.assets or e.character.assets, and a volume from 0 to 100.
PlayMusic
Background music track. Starting a new one stops the previous one.
chat.appTrigger("PlayMusic", chat.scenario.assets.get("background_music.mp3"), 50);| Param | Type | Notes |
|---|---|---|
asset | Asset | The audio track. |
volume | number? | 0-100. Defaults to full. |
PlayAmbient
Ambient sound. Multiple ambient tracks can play simultaneously with different track names.
chat.appTrigger(
"PlayAmbient",
chat.scenario.assets.get("rain_loop.ogg"),
"weather_sounds",
60 // volume 0-100
);StopMusic / StopAmbient
chat.appTrigger("StopMusic");
chat.appTrigger("StopAmbient", "weather_sounds");PlaySound
One-shot SFX. Overlaps with other sounds.
chat.appTrigger("PlaySound", e.character.assets.get("door_creak.wav"), 90);PlayVoice
Queue a pre-recorded voice line as if it were TTS output.
chat.appTrigger("PlayVoice", e.character.assets.get("greeting_line_01.mp3"));PlayCharacterAudio
Play audio from a character's asset folder by path. Combines voice/music/sfx playback into one call — the method decides which audio bus is used.
chat.appTrigger(
"PlayCharacterAudio",
"greeting.mp3", // path inside the character's Assets folder
e.character.id, // character whose assets to look up (defaults to sender)
"voice", // method: "voice" (default) | "insert" | "music" | "background" | "ambient" | "sfx"
"main_track", // trackKey (only used by music/ambient)
80 // volume 0-100
);| Param | Type | Notes |
|---|---|---|
path | string | Path inside the character's Assets/ folder. |
characterId | string? | Whose assets to read from. Defaults to the message sender. |
method | string? | "voice", "insert", "music", "background", "ambient", or "sfx". See Audio methods. |
trackKey | string? | Track identifier for music/ambient stacking. |
volume | number? | 0-100. |
PlayScenarioAudio
Same as PlayCharacterAudio, but resolves paths from the scenario's asset folder instead of a character's.
chat.appTrigger(
"PlayScenarioAudio",
"intro_jingle.mp3", // scenario-relative path
"music", // method
"intro", // trackKey
60 // volume 0-100
);Audio methods
The method decides when the clip is heard.
| Method | When it plays |
|---|---|
"voice" | Queued after all speech generated so far — usually near the end of the reply. |
"insert" | Next: when the current line ends. The rest of the speech waits for it. |
"sfx" | Immediately, over the speech. |
"music" / "ambient" / "background" | A looping track, independent of the speech. |
Use "sfx" for a sound alongside the line (rain, a siren) and "insert" for a beat in it:
// "He picks up the dice." — clatter — "You rolled a six!"
chat.appTrigger("PlayCharacterAudio", "dice.mp3", e.character.id, "insert");From a tool, "insert" lands the sound where the character called for it.