Documentation Index
Fetch the complete documentation index at: https://mintlify.com/VKSFY/keel/llms.txt
Use this file to discover all available pages before exploring further.
AudioSource is an optional ECS component that ties a sound’s logical lifecycle to a specific entity. Most games don’t need it — calling keel.play_sound(app, path) directly from a gameplay system is simpler and covers the majority of one-shot and background-music use cases. AudioSource exists for scenarios where a sound’s existence should mirror an entity’s existence: a pickup that plays on collect, a character voice that must stop when the character despawns, or a positional emitter that will gain distance attenuation in v0.2.
Spatial / positional audio (distance attenuation, Doppler, a listener component) is planned for v0.2. In v0.1 all sounds play at a flat global volume regardless of
Transform2D position.Usage
Fields
An index into a user-maintained sound path registry. Keel does not maintain a global sound ID table — this field is a marker for your own lookup logic. The
AudioEngine does not read sound_id automatically; your systems must map it to a file path before calling play_sound.Intended playback volume for this source, in the range
[0.0, 1.0]. Read by your systems to pass as the volume argument to keel.play_sound. Not automatically enforced by the engine.Whether the sound should loop. Pass this to
keel.play_sound(app, path, loop=source.loop) in your system.A flag your systems can check on the first frame after spawn to decide whether to start playback immediately. The engine does not observe this field automatically.
A flag your systems can set to
True once playback has been initiated and back to False when the SoundHandle reports the sound has finished. Useful for preventing duplicate play calls.Design note
The fields above are all declarative markers —AudioSource has no behavior of its own. The AudioEngine is driven entirely through module-level functions (play_sound, play_music, stop_sound, set_volume). AudioSource simply co-locates intent with the entity so your systems can query for it and react:
