Skip to content
Back to skills

Godot Audio

ASecurity

Godot audio: AudioStreamPlayer in 2D and 3D, buses and effects, music loops and transitions, import settings; silent, late or clipping sound.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythonrustgobashnode

Works with

  • cli

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add tipoLi5890/game-studio --skill godot-audio --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Godot Audio?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Godot Audio
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tipoli5890-godot-audio/badge)](https://www.skillsdirectory.com/skills/tipoli5890-godot-audio)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: godot-audio
description: >-
  Godot audio: AudioStreamPlayer in 2D and 3D, buses and effects, music loops and transitions,
  import settings; silent, late or clipping sound.
---

# godot-audio — players, buses and music

Every sound plays through a player on a bus; the bus layout is a resource the project names.
Headless runs use the Dummy audio driver: nothing is heard, but the mix still runs, so routing,
levels, clipping and ducking can be measured.

## Load what the situation needs

| The situation | Read |
|---|---|
| Setting up sound for a game: which player, which bus | *Players* and *The bus layout* below |
| **Silent, late or clipping** sound | `reference/buses.md` §6, then `scripts/bus_meter.py` |
| Bus volumes, settings sliders, the dB maths | `reference/buses.md` §2 |
| A misspelt bus, a send to nowhere, a muted or soloed bus | `reference/buses.md` §3 |
| Limiter, compressor, ducking music under dialogue, filters | `reference/buses.md` §4 |
| What headless can and cannot prove about audio | `reference/buses.md` §5 |
| Import settings for WAV, Ogg Vorbis, MP3; a track that will not loop | `reference/import.md` |
| Music across scenes, crossfades, music in the pause menu | `reference/music.md` §1-3 · `resources/music_player.gd` |
| Calm-to-chase music, transitions on the bar | `reference/music.md` §4 |
| Many short sounds: pooling, polyphony, the same sound ten times in a frame | *Players* below · `resources/sound_bank.gd` |
| Generating the music and sound effects themselves | `comfyui-asset-generation` |
| Which gameplay event plays which sound | `godot-gameplay` |

## Players

| Node | For | Key properties |
|---|---|---|
| `AudioStreamPlayer` | music, UI, anything heard the same everywhere | `stream`, `bus`, `volume_db`, `pitch_scale`, `max_polyphony` |
| `AudioStreamPlayer2D` | a sound from a place in a 2D world: the gate, a sentry | `max_distance` (px), `attenuation`, `panning_strength`; heard from the current `Camera2D` or an `AudioListener2D` |
| `AudioStreamPlayer3D` | the same in 3D | `unit_size`, `max_distance`, `attenuation_model`, `max_db`; heard from the current camera or an `AudioListener3D` |

- `max_polyphony` is 1 by default: a second `play()` on the same player cuts the first. Raise it
  for a sound that overlaps itself, or use a pool.
- A 2D player past `max_distance` is silent: headless, 2500 px from the camera with the default
  2000 its level reads -200 dB; at 500 px it is panned, about 8 dB down on the far side.
- `play()` starts from 0 each call: never call it every frame.
- `resources/sound_bank.gd` is a pool for non-positional sounds: one bus, a fixed number of
  voices, voice stealing (the oldest is cut), at most `max_per_frame` starts of one sound per
  frame, a little pitch jitter:

```gdscript
const SoundBank = preload("res://audio/sound_bank.gd")
var sfx := SoundBank.new()

func _ready() -> void:
	add_child(sfx)
	sfx.register(&"parcel", preload("res://sfx/parcel.wav"), -3.0)
	sfx.register(&"gate_open", preload("res://sfx/gate_open.wav"))

func _on_parcel_picked() -> void:
	sfx.play(&"parcel")
```

## The bus layout

`templates/default_bus_layout.tres`, copied to `res://default_bus_layout.tres` (the default of
`audio/buses/default_bus_layout`), loads at start-up:

| Bus | Send | Effects | For |
|---|---|---|---|
| Master | — | `AudioEffectHardLimiter`, ceiling -1 dBFS | the sum never clips |
| Music | Master | `AudioEffectCompressor`, sidechain Voice | -6 dB; ducks under dialogue |
| SFX | Master | — | game sounds, `sound_bank.gd` |
| UI | Master | — | menu sounds |
| Voice | Master | — | dialogue, callouts |

Rules that keep it working:

1. **Bus names are a contract.** A player whose bus name is not in the layout plays on Master,
   and its `bus` property reads back "Master"; a bus that sends to a missing bus also lands on
   Master. Both escape their volume sliders without an error.
2. **A limiter on Master**, always: two equal sounds in phase are 6 dB louder than one, and a
   busy moment sums many.
3. **Sliders drive linear volume** (`AudioServer.set_bus_volume_linear`), not dB.
4. **Music keeps its own player** that survives scene changes and runs while the tree is paused
   (`resources/music_player.gd`: equal-power crossfades, no restart of the track already
   playing, `AudioStreamInteractive` clip switches).
5. **Loops are import settings**: `loop=true` for Ogg and MP3, `edit/loop_mode` for WAV.

## Checking it headless

```bash
python3 scripts/bus_meter.py --project game --duck Music:Voice --tone-db -6
```

It loads the project's layout, plays a test tone on each bus alone and then on all of them, and
reads the bus meters, which the Dummy driver keeps live: each bus's route and gain to Master, the
full mix's peak, how far Voice ducks Music. It fails (exit 2) on a bus whose tone never reaches
Master or reaches it 60 dB or more down (with the reason: muted, at -80 dB, another soloed), a
send to a missing bus, a full mix over 0 dBFS, ducking under `--duck-min` dB, a literal bus name
(`bus = &"SFX"`, `var bus: StringName = &"SFX"`) in any scene, resource or script that the layout
lacks, and any `ERROR:` or `WARNING:` line the run prints; exit 3 when nothing was verified (no Godot, a
timeout, no sentinel), 1 a usage error. `--allow-silent BUS` exempts a bus meant to be silent.

What no headless run can tell: what reaches the speakers, the output latency, the OS mixer, a
click at a loop seam, whether the mix sounds right. Those need a person listening.

`scripts/bus_meter.py --selftest` (needs `GODOT_BIN`) measures the template (every bus reaches
Master, Music at -6.00 dB, the limiter holds four hot buses at -1.00 dBFS, Voice ducks Music and
does not duck SFX), fails broken layouts on each fault (muted, soloed, -80 dB, a missing send,
clipping, misspelt names in a scene and a script), and exercises `sound_bank.gd` (the per-frame
cap, the pool, stealing the oldest voice, voices pausing with the tree, `stop_all`) and
`music_player.gd` (an equal-power fade at 0.707 and 0.707 half way, `faded`, no restart, a
fade-out, playing on under a paused tree, `switch_clip` on an `AudioStreamInteractive`).

## Discipline

- **One place plays each kind of sound**: the sound bank for one-shots, the music player for
  music, a 2D or 3D player on the emitter for positioned sound. A stray `AudioStreamPlayer`
  added in a scene is the one with the misspelt bus.
- **Preload what plays during play**; load at the moment of playing only in menus.
- **Name sounds by event** (`parcel`, `gate_open`, `gate_pass`), the same strings the game's
  events use, so a log line and a sound match.
- **Measure before tuning by ear**, then tune by ear: the meter proves routing and headroom, not
  taste.

## Related skills

| Need | Skill |
|---|---|
| Generating music, stingers and sound effects | `comfyui-asset-generation` |
| Which events a game raises, and where sounds hook in | `godot-gameplay` |
| Pausing, scene changes and the autoload that can hold the music player | `godot-scene-flow` |
| Running Godot headless and trusting the result | `godot-verify` |

Files in this skill

  • SKILL.md7 KB
  • reference/buses.md6.4 KB
  • reference/import.md3.3 KB
  • reference/music.md4.7 KB
  • resources/music_player.gd3.5 KB
  • resources/sound_bank.gd2.9 KB
  • scripts/bus_meter.py29.2 KB
  • templates/default_bus_layout.tres1.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.