# Audio System

Use when implementing audio, audio buses, AudioStreamPlayer, spatial audio, music...

- Repository: https://github.com/jame581/GodotPrompter (914 stars)
- Category: Media
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add jame581/GodotPrompter --skill audio-system -g -a claude-code -y`
Codex: `npx skills add jame581/GodotPrompter --skill audio-system -g -a codex -y`
Cursor: `npx skills add jame581/GodotPrompter --skill audio-system -g -a cursor -y`
Gemini CLI: `npx skills add jame581/GodotPrompter --skill audio-system -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add jame581/GodotPrompter`

## Description

Use when implementing audio, audio buses, AudioStreamPlayer, spatial audio, music management, SFX pooling, and dynamic mixing

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

# 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).

```
Master (always exists)
├── Music          → volume, effects for background music
├── SFX            → volume, effects for sound effects
│   ├── Footsteps  → sub-bus for fine-tuning
│   └── Weapons    → sub-bus for fine-tuning
└── UI             → volume for menu sounds
```

**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

```gdscript
extends Node2D

@onready var sfx_player: AudioStreamPlayer2D = $AudioStreamPlayer2D
@onready var music_player: AudioStreamPlayer = $MusicPlayer

func _ready() -> void:
    # Play background music (looping is set on the AudioStream resource)
    music_player.play()

func play_jump_sound() -> void:
    sfx_player.stream = preload("res://audio/sfx/jump.wav")
    sfx_player.play()
```

### C#

```csharp
using Godot;

public partial class AudioExample : Node2D
{
    private AudioStreamPlayer2D _sfxPlayer;
    private AudioStreamPlayer _musicPlayer;

The rest: https://github.com/jame581/GodotPrompter/blob/HEAD/skills/audio-system/SKILL.md
