TheDocumentation 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.
SimpleAudio object is Tea’s core audio subsystem and the backend that powers all audio macros. It manages a registry of named tracks, groups, and playlists, and exposes a master volume and mute layer that sits above individual track volumes. All audio in Tea flows through this object.
The audio subsystem is built on the HTML Media Elements APIs and inherits several platform limitations. True gapless transitions between tracks are not supported. On mobile browsers, hardware controls the device volume, so software volume calls have no effect (though muting still works). Most browsers also require a user gesture before audio can play — see the guidance on
playWhenAllowed() in the AudioTrack reference.General methods
These methods operate on all currently registered tracks at once.SimpleAudio.load()
Pauses playback of all currently registered tracks and, if they are not already loading, drops any existing buffered data and restarts loading from source.
SimpleAudio.loadWithScreen()
Displays the loading screen until all currently registered audio tracks have either loaded to a playable state or aborted loading due to errors. The loading process is identical to SimpleAudio.load().
SimpleAudio.mute([state]) → boolean | undefined
Gets or sets the master volume mute state (default: false). Called without an argument it returns the current mute state; called with a boolean it sets the state and returns undefined.
The mute state to apply.
true mutes all audio; false unmutes.The current master mute state when called without an argument.
SimpleAudio.muteOnHidden([state]) → boolean | undefined
Gets or sets the mute-on-hidden state (default: false). When enabled, the master volume is automatically muted whenever the story’s browser tab loses visibility (switched away or minimized), and unmuted when it regains visibility.
true to enable automatic muting on tab hide; false to disable.The current mute-on-hidden state when called without an argument.
SimpleAudio.select(selector) → AudioRunner
Returns an AudioRunner instance for all tracks matching the given selector string. The AudioRunner exposes the same method surface as AudioTrack and applies every operation to all matched tracks simultaneously.
A space-separated list of track IDs and/or group IDs. Predefined group IDs are
:all, :looped, :muted, :paused, :playing, and :stopped. The :not() modifier syntax (groupId:not(selector)) excludes a subset of tracks from a group selection.An
AudioRunner instance targeting all matched tracks.- Basic
- Playback control
SimpleAudio.stop()
Stops playback of all currently registered tracks.
SimpleAudio.unload()
Stops playback of all currently registered tracks and forces them to drop any buffered data.
Once unloaded, a track cannot play again until it is explicitly reloaded.
SimpleAudio.volume([level]) → number | undefined
Gets or sets the master volume level (default: 1).
The master volume to set. Valid range is
0.0 (silent) to 1.0 (loudest).The current master volume level when called without an argument.
SimpleAudio.tracks
The tracks namespace manages individual named audio tracks that can later be referenced by ID in macros, groups, and playlists.
SimpleAudio.tracks.add(trackId, sources…)
Registers a new audio track under the given ID.
The ID used to reference this track everywhere else in the API.
One or more audio source URLs (absolute or relative), audio passage names, or data URIs. Supplying multiple formats is recommended for cross-browser compatibility. A format specifier prefix (
formatId|) can be prepended when the format cannot be auto-detected from the URL.SimpleAudio.tracks.clear()
Deletes all registered audio tracks.
Tracks that are solely owned by a playlist cannot be deleted this way.
SimpleAudio.tracks.delete(trackId)
Deletes the audio track with the given ID.
The ID of the track to delete.
SimpleAudio.tracks.get(trackId) → AudioTrack | null
Returns the AudioTrack instance for the given track ID, or null if no track with that ID exists.
The ID of the track to retrieve.
The matching
AudioTrack instance, or null on failure.SimpleAudio.tracks.has(trackId) → boolean
Returns true if a track with the given ID exists, false otherwise.
The ID of the track to check.
SimpleAudio.groups
Groups are named collections of track IDs. They let you apply operations to multiple tracks simultaneously and let you use the :not() selector modifier to exclude them from broader selections.
Groups are for simultaneous operations. If you need tracks to play one after another, use a playlist instead.
SimpleAudio.groups.add(groupId, trackIds…)
Creates a new audio group containing the specified track IDs.
The group ID, which must begin with a colon (e.g.,
:ui). The IDs :all, :looped, :muted, :paused, :playing, :stopped, and :not are reserved and cannot be used.The IDs of the tracks to include in the group.
SimpleAudio.groups.clear()
Deletes all audio groups. Does not affect the tracks themselves.
SimpleAudio.groups.delete(groupId)
Deletes the audio group with the given ID. Does not affect the tracks contained in the group.
The ID of the group to delete.
SimpleAudio.groups.get(groupId) → string[] | null
Returns the array of track IDs in the given group, or null if the group does not exist.
The ID of the group.
An array of track ID strings belonging to the group, or
null on failure.SimpleAudio.groups.has(groupId) → boolean
Returns true if a group with the given ID exists.
The ID of the group to check.
SimpleAudio.lists
Playlists play a sequence of tracks one after another. They support shuffle, loop, skip, and all the same volume/mute controls as individual tracks.
If you only need to apply simultaneous actions to multiple tracks without sequencing, use a group instead.
SimpleAudio.lists.add(listId, sources…)
Creates a new playlist. Sources may be bare track IDs or descriptor objects that specify per-track volume and ownership.
The ID used to reference this playlist.
Track IDs or descriptor objects. Two descriptor forms are supported:Existing track form
{ id, [own], [volume] }id— ID of an existing registered track.own(optional) — Whentrue, the playlist creates an independent copy of the track. Owned copies cannot be selected viaSimpleAudio.tracks.get()orSimpleAudio.select().volume(optional) — Base volume for this track within the playlist (0–1). Defaults to the track’s current volume.
{ sources, [volume] }sources— Array of source URLs/passages for an inline track.volume(optional) — Base volume (0–1). Defaults to1.
SimpleAudio.lists.clear()
Deletes all playlists.
SimpleAudio.lists.delete(listId)
Deletes the playlist with the given ID.
The ID of the playlist to delete.
SimpleAudio.lists.get(listId) → AudioList | null
Returns the AudioList instance for the given list ID, or null if no such playlist exists.
The ID of the playlist.
The matching
AudioList instance, or null on failure.SimpleAudio.lists.has(listId) → boolean
Returns true if a playlist with the given ID exists.
The ID of the playlist to check.