Danikakes/spatial_audio_player_3d
About
3D sound in Godot 4 that hears your level: room reverb, wall occlusion by material, and sound that finds its way around corners. A drop-in upgrade for AudioStreamPlayer3D.
Games & EmulationWhat you can do
- Volume Attenuation — Multiple falloff curves (Linear, Logarithmic, Inverse, Natural Sound, and user-defined) with configurable inner and outer radii.
- Room Size Reverb — Omni-directional raycasts estimate room geometry and apply reverb automatically. Works in real time as the player moves between spaces.
- Wall Occlusion — Multi-wall detection with material-based lowpass filtering and volume reduction. Sounds become progressively more muffled behind each wall.
- Air Absorption — Distance-based high-frequency rolloff simulating how air attenuates sound over long distances.
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalSpatial Audio Extended
An advanced, drop-in replacement for Godot's AudioStreamPlayer3D that adds physically-inspired, real-time spatial audio to your 3D games.
Version 4.0.0 · Godot 4.x · by danikakes
It's free, but if you like what I make you can add a tip when you download it on itch.io :)
Licensed under MIT so feel free to use it however you like.
My only ask is if you come up with a better solution to a shortcoming of this plugin, make an issue or a PR with your updates :) happy coding!
Features
- Volume Attenuation — Multiple falloff curves (Linear, Logarithmic, Inverse, Natural Sound, and user-defined) with configurable inner and outer radii.
- Room Size Reverb — Omni-directional raycasts estimate room geometry and apply reverb automatically. Works in real time as the player moves between spaces.
- Wall Occlusion — Multi-wall detection with material-based lowpass filtering and volume reduction. Sounds become progressively more muffled behind each wall.
- Air Absorption — Distance-based high-frequency rolloff simulating how air attenuates sound over long distances.
- Sound Speed Delay — Realistic propagation delay for one-shot sounds. Fire a gunshot across a valley and hear it arrive a moment later.
- Acoustic Materials — Physics-based surface properties (absorption, scattering, transmission) with 12 built-in presets covering brick, concrete, carpet, glass, wood, metal, acoustic foam, and more.
- Debug Overlay — On-screen HUD, in-editor ray visualisation, radius wireframes, and a live A/B effect toggle.
- Rich Signals — Zone transitions, occlusion events, reverb updates, air absorption changes, playback state, and diagnostic data.
- Sound Around Corners —
SpatialReflectionNavigationAgent3Dfinds the corner a sound comes around and places theSpatialAudioPlayer3Din line with it, every frame.
Installation
From itch.io:
- Download it from itch.io. It's free, and you can add a tip if you like.
- Copy the
addons/spatial_audio_extended/folder into your project'saddons/directory. - Go to Project → Project Settings → Plugins and enable Spatial Audio Extended.
From the Godot Asset Library:
- Open your project and go to the AssetLib tab.
- Search for Spatial Audio Extended and install it.
- Go to Project → Project Settings → Plugins and enable Spatial Audio Extended.
Manual:
- Copy the
addons/spatial_audio_extended/folder into your project'saddons/directory. - Enable the plugin in Project → Project Settings → Plugins.
Quick Start
Replace any AudioStreamPlayer3D in your scene with a SpatialAudioPlayer3D. All existing properties and method calls work identically — no code changes needed.
# No changes required. play(), stop(), is_playing() all work as before.
$MySpatialAudio.play()
To give surfaces acoustic properties, add an AcousticBody node as a direct child of any StaticBody3D, RigidBody3D, Area3D, or CSGShape3D, then assign one of the built-in material presets:
StaticBody3D (concrete wall)
├── CollisionShape3D
├── MeshInstance3D
└── AcousticBody <-- assign concrete.tres here
The plugin adds an "Add AcousticBody" button to the Inspector when a CollisionShape3D or CSGShape3D is selected, so you can skip the Add Node dialog.
Node Overview
| Node | Description |
|---|---|
SpatialAudioPlayer3D |
The main audio player. Drop-in for AudioStreamPlayer3D. |
SpatialReflectionNavigationAgent3D |
Carries a player's sound around walls, so it comes from the corner or doorway. |
AudioPathArea3D |
Optional. Keeps the navigation agent's routing inside shapes you size in the editor. |
AcousticBody |
Attach to collision geometry to define its acoustic surface properties. |
AcousticMaterial |
Resource defining absorption, scattering, and transmission per frequency band. |
Acoustic Material Presets
12 presets are included, based on real-world acoustic data:
brick · concrete · ceramic · carpet · glass · gravel · metal · plaster · rock · wood · generic · acoustic_foam
# Load from disk
var mat = load("res://addons/danikakes.spatial_audio/presets/concrete.tres")
# Or use a static constructor
var mat = AcousticMaterial.preset_concrete()
Signals
# Zone transitions
signal inner_radius_entered(listener)
signal inner_radius_exited(listener)
signal falloff_zone_entered(listener)
signal falloff_zone_exited(listener)
signal attenuation_zone_entered(listener)
signal attenuation_zone_exited(listener)
# Occlusion
signal audio_occluded(listener, wall_count)
signal audio_unoccluded(listener)
signal occlusion_changed(wall_count, cutoff_hz)
# Reverb / air absorption
signal reverb_updated(room_size, wetness, damping)
signal reverb_zone_changed(room_size, wetness)
signal air_absorption_updated(cutoff_hz)
# Playback
signal spatial_audio_playback_started()
signal spatial_audio_playback_stopped()
signal listener_distance_changed(distance)
Global Effect Toggle
Disable all spatial effects across every instance at once — useful for accessibility or performance modes:
SpatialAudioPlayer3D.set_global_effects_disabled(true)
Sound Around Corners
SpatialReflectionNavigationAgent3D works out how sound travels around walls to reach the listener, and places a SpatialAudioPlayer3D so the sound comes from the corner it bends around.
Quick Setup
- Add
SpatialReflectionNavigationAgent3Dto your scene where the sound comes from. - Add a
SpatialAudioPlayer3Das its child. - Run the scene. Turn on
debug_draw_routeto see the route.
Notable Capabilities
- Fills the open space with cells, over and under things as well as around them
- Finds the corner every physics frame, so the sound follows you with no lag
- Volume and air absorption fall off by the real route length
- The sound gets quieter and darker the more it bends
- Doors and moving walls change the route on their own
- Route details in the
SpatialAudioPlayer3Ddebug panel - Optional
AudioPathArea3Dchild keeps the routing inside the rooms you size it to
Documentation
Full documentation is at spatial-audio-extended.danikakes.dev, and you can play the demo in your browser:
- Installation
- Your first steps
- Surfaces and materials
- Material presets
- Sound around corners
- Debug tools
- Tips and recipes
- SpatialAudioPlayer3D reference
- AcousticBody reference
- AcousticMaterial reference
- SpatialReflectionNavigationAgent3D reference
- AudioPathArea3D reference
- Signals reference
- Troubleshooting
License
See LICENSE.
Explore related projects
Loading…