jame581/godotprompter/audio-system
Claude Code and agent skill by jame581/godotprompter
- community
Checking that the SKILL.md file is still in the repository.
Use when implementing audio — audio buses, AudioStreamPlayer, spatial audio, music management, SFX pooling, and dynamic mixing
Install
npx vskill@latest install jame581/godotprompter/audio-systemSKILL.md
The same SKILL.md was published earlier as jame581/godotprompter/audio-system.
Audio System in Godot 4.3+
All examples target Godot 4.3+ with no deprecated APIs. GDScript is shown first, then C#.
Related skills: event-bus for decoupled audio triggers, save-load for persisting audio settings, resource-pattern for audio data containers.
1. Core Concepts
Audio Node Types
| Node | Dimensions | Use For | |
|---|---|---|---|
AudioStreamPlayer | Non-positional | Music, UI sounds, global SFX | |
AudioStreamPlayer2D | 2D positional | Footsteps, gunfire, environmental sounds | |
AudioStreamPlayer3D | 3D positional | Same as 2D but in 3D space |
Audio Bus Architecture
Godot routes all audio through buses (like a mixing console).
Setup: Bottom panel → Audio tab → Add buses, set names, route outputs.
Every AudioStreamPlayer has a bus property — set it to the target bus name (e.g., "SFX", "Music").
2. Basic Audio Playback
GDScript
C#
Looping Audio
Looping is configured on the AudioStream resource, not the player node:
- WAV: Import tab → Loop Mode → Forward (or Ping-Pong)
- OGG: Import tab → Loop → On, set Loop Offset
- MP3: Import tab → Loop → On
Always use OGG Vorbis for music (smaller files, good quality). Use WAV for short SFX (PCM or QOA, cheap to decode). Avoid MP3 for SFX — depending on the encoder it can start with padding silence.
3. Audio Bus Management
Setting Volume from Code
Godot uses decibels (dB) for volume. Linear-to-dB conversion is required for sliders.
GDScript
C#
Audio Bus Effects
Add effects to buses in the Audio panel (bottom dock). Common effects:
| Effect | Use For | |
|---|---|---|
Reverb | Cave, cathedral, bathroom ambience | |
Delay | Echo effects | |
Compressor | Normalize loud/quiet sounds (master bus) | |
HardLimiter | Prevent clipping on master bus (Limiter is deprecated) | |
LowPassFilter | Muffled sounds (underwater, behind walls) | |
HighPassFilter | Thin/tinny sound (radio, phone) | |
Chorus | Thicken sounds | |
Distortion | Gritty/overdrive effects | |
EQ | Fine-tune frequency bands |
Dynamic Effect Toggle
4. Spatial Audio (2D & 3D)
AudioStreamPlayer2D
Automatically adjusts volume and panning based on distance to the current AudioListener2D (or the centre of the screen if none is current).
Key properties:
| Property | Description | Default | |
|---|---|---|---|
max_distance | Beyond this distance, sound is silent | 2000.0 | |
attenuation | Volume falloff curve (1.0 = linear, higher = sharper) | 1.0 | |
max_polyphony | Max simultaneous instances of this player | 1 | |
panning_strength | How much the sound pans left/right | 1.0 |
AudioStreamPlayer3D
Same concept but in 3D. Works with AudioListener3D (or the Camera3D).
Key additional properties:
| Property | Description | |
|---|---|---|
unit_size | Distance at which volume is 0 dB | |
max_db | Maximum volume cap | |
attenuation_model | Inverse, InverseSquare, Logarithmic, Disabled | |
doppler_tracking | Enable Doppler effect for moving sources |
AudioListener
⚠️ Changed in Godot 4.7: The defaultarea_maskonAudioStreamPlayer2D/AudioStreamPlayer3Dchanged from1to0(disabled) — theaudio_bus_overridefeature onArea2D/Area3D(e.g. an underwater bus) stops working for players left at the default. Setarea_maskback to layer 1 to restore it; masks explicitly set to anything other than layer 1 keep working. (The migration guide says "AudioStreamPlayer", butarea_maskonly exists on the 2D/3D variants.) See the 4.7 migration guide.
5. Music Manager (Autoload)
Crossfade between background tracks via a singleton autoload that manages two AudioStreamPlayer nodes and tweens their volume_db. Wire a Music audio bus so the settings menu can adjust music separately.
See references/music-manager.md for the full GDScript and C# autoload (crossfade, fade-out stop, music bus volume).
6. SFX Pool
Pre-instantiate a fixed pool of AudioStreamPlayer nodes; play_sfx(stream) finds the next free player and plays. Avoids per-shot instancing churn for high-volume effects (gunshots, footsteps, hits).
See references/sfx-pooling.md for the GDScript + C# pooled player and a 2D positional variant (pool ofAudioStreamPlayer2Dnodes that follow a target).
7. Audio Settings Integration
Wire HSliders in the settings menu to bus volumes via AudioServer.set_bus_volume_db(bus_idx, linear_to_db(value)). Persist with ConfigFile. Use the linear_to_db / db_to_linear helpers — never log-base by hand.
See references/audio-settings.md for the full settings menu wiring with persistence (GDScript + C#).
8. Interactive & Adaptive Music (Godot 4.3+)
Three stream types for adaptive music: AudioStreamPlaylist (sequenced or shuffled tracks), AudioStreamSynchronized (multiple stems played in sync — vertical layering for combat intensity), AudioStreamInteractive (clip transitions on triggers — state-driven music). Godot 4.4+ adds AudioStreamWAV.load_from_file() for runtime WAV loading.
Godot 4.7+:AudioStreamInteractivenow exposesTRANSITION_TO_TIME_PREVIOUS_POSITION(TransitionToTimeenum) to scripts — the destination clip resumes from its last played position if there was a previous transition from that clip, otherwise it plays from its start. Ideal for exploration ↔ combat music that picks up where it left off.
See references/interactive-music.md for the stream-type comparison, GDScript recipes, the 4.7+ resume-position transition, and the 4.4+ runtime-load example.
9. Audio Import Best Practices
| Format | Use For | File Size | Decode Latency | Loop Support | |
|---|---|---|---|---|---|
| WAV | Short SFX | Large | None (PCM) / light (QOA, 4.4+ default) | Via import | |
| OGG | Music, long SFX | Small | Minimal | Via import | |
| MP3 | Music (fallback) | Small | Has padding | Via import |
Import Settings
In the Import dock (select an audio file):
- Loop: Enable for music and ambient loops
- BPM / Beat Count / Bar Beats: Set for rhythm-synced games
- Force Mono (WAV only): Enable for 3D positional audio (stereo doesn't spatialize well); export OGG/MP3 as mono from your audio editor
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/audio-system/SKILL.md
Popularity
- Repository stars
- 354
- Repository forks
- 18
- 7-day trend score
- 29
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jame581/godotprompter/audio-system)