# Godot Audio

Play and mix audio in Godot 4.7: AudioStreamPlayer (2D/3D variants), audio buses with...

- Repository: https://github.com/gamedev-skills/awesome-gamedev-agent-skills (6445 stars)
- Category: Media
- License: Apache-2.0
- Last updated: 2026-10-28
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -g -a claude-code -y`
Codex: `npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -g -a codex -y`
Cursor: `npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -g -a cursor -y`
Gemini CLI: `npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-audio -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add gamedev-skills/awesome-gamedev-agent-skills`

## Description

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 to buses, adjusting bus volume via AudioServer, or syncing gameplay to the beat.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Godot Audio (4.x)

Play SFX and music, route them through buses, control volume in decibels, and time
gameplay to the beat. Targets **Godot 4.7**.

## When to use

- Use when playing sound effects or music, routing audio to buses (Master/Music/SFX),
  adjusting volume/mute from code, adding bus effects (reverb, compressor), positional 3D
  audio, or syncing events to music.

**When *not* to use:** engine-agnostic audio *design* (adaptive music structure, mixing
philosophy, ducking patterns) → `audio-design`; importing/encoding assets outside Godot.

## Core workflow

1. **Pick the player node:**
   - `AudioStreamPlayer`, non-positional (music, UI, global SFX).
   - `AudioStreamPlayer2D` / `AudioStreamPlayer3D`, positional; volume/pan from distance.
2. **Assign an `AudioStream`** to `stream` (`.ogg` for music/loops, `.wav` for short SFX)
   and `play()`. Set `autoplay` for music that starts with the scene.
3. **Route to a bus.** Set the player's `bus` to a named bus (e.g. `"Music"`, `"SFX"`).
   Define buses in the Audio panel (bottom dock); each can have volume, mute, solo, and
   effects.
4. **Control volume in dB**, not linear (audio is logarithmic). `0 dB` = unchanged,
   `-80 dB` ≈ silent. Convert with `linear_to_db`/`db_to_linear`, or use the linear helpers
   (`volume_linear` on players, `AudioServer.set_bus_volume_linear()`), which convert for you.
5. **Drive volume/mute from code** with `AudioServer` by bus index.
6. **For rhythm**, compute precise playback time using output latency compensation.

## Patterns

### 1. One-shot SFX (fire-and-forget)

```gdscript
@onready var sfx: AudioStreamPlayer = $Sfx   # stream assigned in the editor

func play_jump() -> void:
    sfx.pitch_scale = randf_range(0.95, 1.05)   # slight variation avoids fatigue
    sfx.play()

# For overlapping copies, raise sfx.max_polyphony (default 1), use an
# AudioStreamPolyphonic stream, or spawn short-lived players and free on `finished`.
```

The rest: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/HEAD/skills/godot/godot-audio/SKILL.md
