
Bevy Audio Systems
Bevy ECS skill for audio playback.
Install
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill bevy-audio-systems -g -a claude-code -y- Repository
- thedivergentai/Game-Dev-Agentic-Skills917
- Category
- Media
- Updated
- 19d ago
- License
- LGPL-3.0
- Context cost
- Mediumabout 1,973 tokens
- Runs scripts
- No, instructions only
What it does
Bevy ECS skill for audio playback. Keywords: Bevy, AudioPlayer, AudioSink, PlaybackSettings, AssetServer.
Bevy audio systems
When to use
Load this when a clip should start, loop, pause, or change volume. bevy::audio in Bevy 0.20 and the audio_control example are the sources.
ECS shape
- Play: spawn
AudioPlayer::new(asset_server.load(...)).AudioPlayer<Source>holdsHandle<Source>whereSource: Asset + Decodable. If the asset is not ready, playback starts when it is.AudioPlayerrequiresPlaybackSettings. - Settings:
PlaybackSettingsconfigures the start.PlaybackSettings::LOOPand.with_spatial(true)appear in the spatial examples. Changes toPlaybackSettingsdo not affect audio that is already playing.PlaybackModeisOnce,Loop,Despawn, orRemove. - Control: when playback begins, Bevy inserts
AudioSink. The control example queriesAudioSinkand callspause,toggle_mute,set_volume,set_speed, andposition.SpatialAudioSinkis the spatial counterpart named on the playback page. - Replay: after a non-looping sound finishes and the sink is drained, that
AudioPlayercannot be reused. Remove the audio components and add them again. - Schedule: spawn on
Startupor from a system that hasRes<AssetServer>andCommands. Control systems in the example run where they readButtonInput<KeyCode>andRes<Time>.
Playback pieces
| Need | Bevy idiom |
|---|---|
| Start a file | AudioPlayer::new plus AssetServer::load |
| Loop | PlaybackSettings::LOOP |
| Pause, mute, or volume while playing | AudioSink methods on the same entity |
| One-shot that should leave the world | PlaybackMode::Despawn or Remove |
| Positional emitter | PlaybackSettings with with_spatial(true) and SpatialAudioSink |
Examples
[dependencies]
bevy = "0.20"
AudioPlayer starts when the handle is ready. PlaybackSettings applies only at that start. AudioSink is inserted once playback begins and is the live control.
use bevy::audio::{AudioSinkPlayback, Volume};


