Skip to main content

Overview

Godot provides a powerful and flexible audio system built around the AudioServer, which handles all audio processing, mixing, and output. The system supports multiple audio formats, real-time effects, and spatial audio for 2D and 3D games.
The AudioServer uses a bus-based architecture similar to professional audio software, allowing complex audio routing and effects chains.

AudioServer

The AudioServer is a singleton that manages all audio in your game. It provides low-level audio access and controls the audio bus system.

Key Features

  • Audio buses - Route audio through different channels with independent volume and effects
  • Real-time effects - Apply effects like reverb, delay, EQ, and compression
  • Flexible routing - Send audio from one bus to another
  • Sample rate control - Access to mix rate and output latency
  • Device selection - Choose input/output audio devices

Getting Audio Information

Audio Buses

Audio buses are channels that audio streams flow through. Each bus can have:
  • Independent volume control
  • Multiple audio effects
  • Routing to other buses
  • Solo/mute states

Working with Buses

Volume Control

AudioServer works with decibels (dB) for volume:
0 dB represents no change in volume. Negative values reduce volume, positive values amplify (but may cause clipping).

AudioStreamPlayer

The AudioStreamPlayer node plays audio streams without positional audio:
Key Properties:
  • stream - The AudioStream resource to play
  • volume_db - Volume in decibels (offset from stream volume)
  • pitch_scale - Playback speed/pitch multiplier
  • bus - Target audio bus name
  • autoplay - Start playing when entering the tree
  • max_polyphony - Maximum simultaneous sounds
Key Methods:
  • play(from_position) - Start playback
  • stop() - Stop playback
  • seek(to_position) - Jump to a position in seconds
  • get_playback_position() - Get current position in seconds

AudioStreamPlayer2D and AudioStreamPlayer3D

For positional audio in 2D and 3D games:

AudioStreamPlayer2D

AudioStreamPlayer3D

3D audio automatically handles attenuation (volume falloff) based on distance and supports different attenuation models.

Playback Control

Basic Playback

Polyphony

Play multiple sounds simultaneously from one player:

Monitoring Playback

Bus Routing

Route audio from one bus to another:

Peak Volume Monitoring

Monitor audio levels on buses:

Best Practices

Separate audio into different buses (Music, SFX, Voice) to allow independent volume control and effects.
Load short sound effects at startup to avoid loading delays during gameplay.
Large audio files (music, voice) should use streaming formats like OGG Vorbis to reduce memory usage.
Set appropriate max_polyphony values to prevent audio overload while allowing necessary overlaps.

See Also

Audio Streams

Learn about audio formats and stream types

Audio Effects

Add effects like reverb, delay, and EQ to audio buses

Interactive Music

Create dynamic, adaptive music systems