Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/pompom454/tea/llms.txt

Use this file to discover all available pages before exploring further.

Tea’s audio macros wrap the built-in SimpleAudio subsystem. They let you register tracks, control playback with fade support, organize tracks into groups or playlists, and manage master volume—all from within passage text.
The audio subsystem has browser-imposed limitations around autoplay, format support, and data loading. Read the SimpleAudio API limitations before building audio-heavy stories. Network-hosted audio in particular can consume significant player bandwidth.

<<cacheaudio trackId sourceList>>

Registers an audio track for use by all other audio macros. Supply one or more source URLs so the browser can pick a format it supports. Best done in the StoryInit special passage.
→ Single source via relative URL
<<cacheaudio "boom" "media/audio/explosion.mp3">>

→ Single source via an audio passage name
<<cacheaudio "boom" "explosion">>

→ Multiple sources (browser picks the first it supports)
<<cacheaudio "bgm_space" "media/audio/space_quest.mp3" "media/audio/space_quest.ogg">>

→ Source with an explicit format specifier (when the extension can't be detected)
<<cacheaudio "what" "mp3|http://an-audio-service.com/a-user/a-track-id">>
trackId
string
required
A unique identifier string used to reference the track in other audio macros.
sourceList
strings
required
One or more space-separated audio sources: relative URLs, absolute URLs, audio passage names, or data URIs. Prepend a format specifier (mp3|, ogg|, wav|, etc.) when the format cannot be inferred from the URL.

<<audio trackIdList actionList>>

Controls playback of one or more tracks. Accepts individual track IDs, predefined group IDs, or custom group IDs as the target list.
→ Start, pause, and stop a track
<<audio "bgm_space" play>>
<<audio "bgm_space" pause>>
<<audio "bgm_space" stop>>

→ Play at 50% volume
<<audio "bgm_space" volume 0.5 play>>

→ Start 120 seconds in
<<audio "bgm_space" time 120 play>>

→ Loop playback
<<audio "bgm_space" loop play>>

→ Navigate to a passage when the track ends normally
<<audio "bgm_space" play goto "Peace Moon">>
Available actions:
ActionDescription
playStart playback
pausePause playback
stopStop playback
loopEnable looping
unloopDisable looping (default)
muteMute volume
unmuteUnmute volume (default)
volume levelSet volume (0–1)
time secondsSeek to position
fadeinFade to volume 1 over 5 seconds
fadeoutFade to volume 0 over 5 seconds
fadeto levelFade to level over 5 seconds
fadeoverto seconds levelFade to level over N seconds
goto passageNavigate when track ends normally
loadForce reload of buffered data
unloadDrop all buffered data
<<audio>> cannot affect tracks whose ownership has been transferred to a playlist (those registered with the own action in <<createplaylist>>). Owned tracks are under exclusive control of their playlist.

<<createaudiogroup groupId>> … <</createaudiogroup>>

Collects previously cached tracks into a named group using <<track>> child macros. Groups let you target several tracks simultaneously via <<audio>> without listing each one individually. Group IDs must start with a colon.
→ Best placed in StoryInit
<<cacheaudio "ui_beep"  "media/audio/ui/beep.mp3">>
<<cacheaudio "ui_boop"  "media/audio/ui/boop.mp3">>
<<cacheaudio "ui_swish" "media/audio/ui/swish.mp3">>

<<createaudiogroup ":ui">>
    <<track "ui_beep">>
    <<track "ui_boop">>
    <<track "ui_swish">>
<</createaudiogroup>>

→ Now use the group
<<audio ":ui" volume 0.5>>
<<audio ":playing:not(:ui)" stop>>
groupId
string
required
The unique group ID. Must start with a colon (e.g. :ui, :music). Cannot reuse predefined IDs (:all, :looped, :muted, :paused, :playing, :stopped) or :not.

<<createplaylist listId>> … <</createplaylist>>

Creates a playlist from cached tracks via <<track>> children. Each track may optionally set a volume and/or be registered as an owned copy (exclusively controlled by the playlist).
<<cacheaudio "swamped"       "media/audio/Swamped.mp3">>
<<cacheaudio "heavens_a_lie" "media/audio/Heaven's_A_Lie.mp3">>
<<cacheaudio "closer"        "media/audio/Closer.mp3">>
<<cacheaudio "to_the_edge"   "media/audio/To_The_Edge.mp3">>

<<createplaylist "bgm_lacuna">>
    <<track "swamped"       volume 1>>
    <<track "heavens_a_lie" volume 0.5>>
    <<track "closer"        own>>
    <<track "to_the_edge"   volume 1 own>>
<</createplaylist>>
listId
string
required
The unique ID for the playlist.
<<track>> actions within <<createplaylist>>:
ActionDescription
volume levelOptional. Base volume for this track in the playlist (0–1).
ownOptional. Creates an independent copy solely controlled by this playlist.

<<masteraudio actionList>>

Controls the master audio bus—affects all tracks simultaneously.
<<masteraudio stop>>
<<masteraudio volume 0.40>>
<<masteraudio mute>>
<<masteraudio unmute>>
<<masteraudio muteonhide>>
<<masteraudio nomuteonhide>>

→ Load / unload all tracks (use with care on networked audio)
<<masteraudio load>>
<<masteraudio unload>>
ActionDescription
stopStop all tracks
muteMute master volume
unmuteUnmute master volume (default)
volume levelSet master volume (0–1)
muteonhideAuto-mute when browser tab loses visibility
nomuteonhideDisable auto-mute on hide (default)
loadForce all tracks to reload
unloadDrop all track data

<<playlist listId actionList>>

Controls playback of a named playlist created via <<createplaylist>>. Supports the same fade actions as <<audio>> plus playlist-specific actions like shuffle and skip.
→ Play, pause, stop
<<playlist "bgm_lacuna" play>>
<<playlist "bgm_lacuna" pause>>
<<playlist "bgm_lacuna" stop>>

→ Volume and fading
<<playlist "bgm_lacuna" volume 0.5 play>>
<<playlist "bgm_lacuna" volume 0 fadein>>
<<playlist "bgm_lacuna" volume 0.75 fadeout>>
<<playlist "bgm_lacuna" volume 0.25 fadeto 0.75>>
<<playlist "bgm_lacuna" volume 0.25 fadeoverto 30 0.75>>

→ Shuffle and loop
<<playlist "bgm_lacuna" shuffle play>>
<<playlist "bgm_lacuna" unloop play>>

→ Skip current track
<<playlist "bgm_lacuna" skip>>

→ Mute / unmute
<<playlist "bgm_lacuna" mute>>
<<playlist "bgm_lacuna" unmute>>

<<removeaudiogroup groupId>>

Removes a custom audio group. The predefined groups (:all, :looped, :muted, :paused, :playing, :stopped) and :not cannot be removed.
<<removeaudiogroup ":ui">>

<<removeplaylist listId>>

Removes a playlist that was created with <<createplaylist>>.
<<removeplaylist "bgm_lacuna">>

<<waitforaudio>>

Displays the loading screen until all currently registered audio has either loaded to a playable state or aborted due to errors. Invoke it once after registering the tracks you want to preload.
→ Wait for all registered tracks
<<cacheaudio "a" "a_track.mp3">>
<<cacheaudio "b" "b_track.mp3">>
<<cacheaudio "c" "c_track.mp3">>
<<waitforaudio>>

→ Selective preload — only wait for "a" and "b"; register "c" and "d" later
<<cacheaudio "a" "a_track.mp3">>
<<cacheaudio "b" "b_track.mp3">>
<<waitforaudio>>
<<cacheaudio "c" "c_track.mp3">>
<<cacheaudio "d" "d_track.mp3">>
<<waitforaudio>> should be called once, after <<cacheaudio>> and any <<createplaylist>> definitions that use the copy action, for the loading screen to reflect those tracks. Calling it multiple times is unnecessary.

Build docs developers (and LLMs) love