ai-behavior-trees-util…
Build a production behavior-tree runtime (Blackboard, action/condition leaves, sequence/selector/parallel composites, decorators)…
Play and mix audio in Godot 4.7: AudioStreamPlayer (2D/3D variants), audio buses with volume/mute and effects, music vs SFX routing, db/linear volume, and precise sync-to-beat playback timing. Use when playing sounds or music in a Godot project, routing AudioStreamPlayer nodes
Claude Code
$ npx -y skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio --agent claude-code
Codex
$ npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -a codex -y
Cursor
$ npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -a cursor -y
Gemini CLI
$ npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -a gemini-cli -y
GitHub Copilot
$ npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -a github-copilot -y
OpenCode
$ npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -a opencode -y
Windsurf
$ npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -a windsurf -y
name: godot-audio description: > Godot 4.7 audio APIs: AudioStreamPlayer 2D and 3D, the bus layout, AudioServer volume and mute, polyphony, looping imports and playback position for beat sync. Use when wiring SFX, music or volume sliders in Godot, or a sound is silent, cut off, does not loop or ignores its bus. Not for engine-neutral mixing, ducking or adaptive music (`audio-design`).
Play, route and control sound through Godot's player nodes and `AudioServer`, then prove the bus wiring with a headless check. Targets **Godot 4.7**; check `config/features` in `project.godot` first.
1. **Read the bus layout first.** It lives in the file named by `audio/buses/default_bus_layout` (default `res://default_bus_layout.tres`); each `bus/N/name` is a bus. Bus names in scenes and code must match it exactly. 2. **Pick the node:** `AudioStreamPlayer` for music, UI and global SFX; `AudioStreamPlayer2D`/`3D` when distance and panning matter. 3. **Route every player** by setting `bus` (for example `&"SFX"`). Add a bus by editing the layout file, the Audio dock, or `AudioServer.add_bus()` at runtime. 4. **Volume is in decibels.** For 0..1 sliders use `volume_linear` on players and `AudioServer.set_bus_volume_linear()`, which convert for you. 5. **Loops are an import setting.** Set loop on the `.ogg`/`.mp3`/`.wav` import (or `AudioStreamWAV.loop_mode`), not on the player. 6. **Verify before you finish** (paths are relative to this skill's folder):
It loads the real bus layout and fails on every `bus = "..."` or `get_bus_index("...")` name it does not define, with file and line.
to catch missing stream files.
`playing`, `get_playback_position()` and `finished` behave (see `godot-gdscript-headless-testing` for the runner). Loudness and mix cannot: ask the user to listen and report levels, clipping and anything inaudible.
@onready var sfx: AudioStreamPlayer = $Sfx # stream assigned in the scene
func _ready() -> void:
sfx.max_polyphony = 4 # default 1: a retrigger cuts the last play
func play_hit() -> void:
sfx.pitch_scale = randf_range(0.95, 1.05)
sfx.play()For many variants use an `AudioStreamRandomizer` as the stream instead of code.
func set_bus_volume(bus_name: StringName, value_0_to_1: float) -> void:
var bus := AudioServer.get_bus_index(bus_name)
if bus == -1:
push_error("No audio bus named %s" % bus_name)
return
AudioServer.set_bus_mute(bus, value_0_to_1 <= 0.0) # mute at 0 instead of -inf dB
if value_0_to_1 > 0.0:
AudioServer.set_bus_volume_linear(bus, value_0_to_1)@onready var a: AudioStreamPlayer = $MusicA
@onready var b: AudioStreamPlayer = $MusicB
func crossfade_to(stream: AudioStream, secs := 1.5) -> void:
b.stream = stream
b.volume_db = -40.0
b.play()
var tw := create_tween().set_parallel(true)
tw.tween_property(a, "volume_db", -40.0, secs)
tw.tween_property(b, "volume_db", 0.0, secs)
tw.chain().tween_callback(a.stop) # bound to the old player now
var old := a
a = b
b = old@onready var music: AudioStreamPlayer = $Music
func song_time() -> float:
# playback position only updates once per mix; add the time since then, minus latency.
return music.get_playback_position() + AudioServer.get_time_since_last_mix() \
- AudioServer.get_output_latency()Compare `song_time()` against beat times; `audio-design` covers quantizing and pre-roll.
Godot falls back to Master without an error, reading `player.bus` back returns `Master`, and `get_bus_index()` returns -1 (later `AudioServer` calls on -1 print an out-of-bounds error). Run the bus check.
`linear_to_db()`.
`set_bus_volume_linear(bus, 0.0)` stores `-inf` too. Mute at zero, as in Pattern 2.
small, or `unit_size` too low for the scene's scale.
`area_mask` now defaults to 0. Tick the area's layer in the player's `area_mask`.
chunk. Use Pattern 4. Headless runs report an output latency of 0, so tune latency on the real device.
since 4.3 the web export plays through the browser's Web Audio API ("Sample" playback), which skips them. Set the player's `playback_type` to Stream, or `audio/general/default_playback_type.web` for the project, at the cost of more latency.
API, the effect list, side-chain compression, `AudioStreamPolyphonic`, `AudioStreamInteractive` and friends, positional audio settings, and `AudioStreamGenerator`.
<img src="docs/assets/awesome-gamedev-agent-skills-banner.png" width="820" alt="awesome-gamedev-agent-skills — game-dev skills for AI coding agents.
Build a production behavior-tree runtime (Blackboard, action/condition leaves, sequence/selector/parallel composites, decorators)…
Implement game audio practice — bus/mixer architecture and gain in decibels, ducking (sidechain), adaptive/dynamic music via…
Build game cameras that feel good — 2D follow with a deadzone, look-ahead, smoothing, and level-bounds clamping; 3D third-person…
Plan, generate, source, normalize, and validate cohesive visual game assets. Use for art direction, style bibles, sprites,…
Build branching dialogue and narrative — a node/choice graph with conditions, variables, and localization hooks — and choose…
Design NPC and enemy decision-making with finite state machines, behavior trees, steering behaviors, and A* pathfinding —…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.