Claude-Code-Game-Studios/docs/engine-reference/godot/modules/audio.md
Donchitos ad540fe75d Game Studio Agent Architecture — complete setup (Phases 1-7)
48 coordinated Claude Code subagents for indie game development:
- 3 leadership agents (creative-director, technical-director, producer)
- 10 department leads (game-designer, lead-programmer, art-director, etc.)
- 23 specialist agents (gameplay, engine, AI, networking, UI, tools, etc.)
- 12 engine-specific agents (Godot, Unity, Unreal with sub-specialists)

Infrastructure:
- 34 skills (slash commands) for workflows, reviews, and team orchestration
- 8 hooks for commit validation, asset checks, session management
- 11 path-scoped rules enforcing domain-specific standards
- 28 templates for design docs, reports, and collaborative protocols

Key features:
- User-driven collaboration protocol (Question → Options → Decision → Draft → Approval)
- Engine version awareness with knowledge-gap detection (Godot 4.6 pinned)
- Phase gate system for development milestone validation
- CLAUDE.md kept under 80 lines with extracted doc imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:04:24 +11:00

79 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Godot Audio — Quick Reference
Last verified: 2026-02-12 | Engine: Godot 4.6
## What Changed Since ~4.3 (LLM Cutoff)
No major breaking changes to the audio API in 4.44.6. The core audio system
remains stable. Key updates are workflow improvements:
### 4.6 Changes
- **No audio-specific breaking changes** in this release
### 4.5 Changes
- **No audio-specific breaking changes** in this release
## Current API Patterns
### Playing Audio
```gdscript
@onready var sfx_player: AudioStreamPlayer = %SFXPlayer
@onready var music_player: AudioStreamPlayer = %MusicPlayer
func play_sfx(stream: AudioStream) -> void:
sfx_player.stream = stream
sfx_player.play()
func play_music(stream: AudioStream, fade_time: float = 1.0) -> void:
var tween: Tween = create_tween()
tween.tween_property(music_player, "volume_db", -80.0, fade_time)
await tween.finished
music_player.stream = stream
music_player.volume_db = 0.0
music_player.play()
```
### 3D Spatial Audio
```gdscript
@onready var audio_3d: AudioStreamPlayer3D = %AudioPlayer3D
func _ready() -> void:
audio_3d.max_distance = 50.0
audio_3d.attenuation_model = AudioStreamPlayer3D.ATTENUATION_INVERSE_DISTANCE
audio_3d.unit_size = 10.0
```
### Audio Buses
```gdscript
# Set bus volumes
AudioServer.set_bus_volume_db(AudioServer.get_bus_index(&"Music"), volume_db)
AudioServer.set_bus_volume_db(AudioServer.get_bus_index(&"SFX"), volume_db)
# Mute a bus
AudioServer.set_bus_mute(AudioServer.get_bus_index(&"Music"), true)
```
### Object Pooling for SFX
```gdscript
# Pre-create multiple AudioStreamPlayer nodes for concurrent sounds
var _sfx_pool: Array[AudioStreamPlayer] = []
func _ready() -> void:
for i in range(8):
var player := AudioStreamPlayer.new()
player.bus = &"SFX"
add_child(player)
_sfx_pool.append(player)
func play_pooled(stream: AudioStream) -> void:
for player in _sfx_pool:
if not player.playing:
player.stream = stream
player.play()
return
```
## Common Mistakes
- Creating new AudioStreamPlayer nodes at runtime instead of pooling
- Not using audio buses for volume categories (Music, SFX, UI, Voice)
- Using `_process()` for audio timing instead of signals (`finished`)