Audio Manager
Plugin for Godot 4.5x
A comprehensive audio management solution for Godot projects that provides enhanced control over audio playback with support for 2D and 3D audio streams, clipping functionality, and advanced audio properties.
Audio Manager manages 3 main classes: AudioMangerPlus, AudioMangerPlus2D, and AudioMangerPlus3D, each representing the native Godot classes AudioStreamPlayer, AudioStreamPlayer2D, and AudioStreamPlayer3D, respectively.
AudioMangerPlus (omni, 2D, and 3D) replaces the old Audio Manager v1.x classes (AudioMangerOmni, AudioManger2D, and AudioManger3D). These 3 new nodes come with the package, and you can add them separately without needing AudioManager if you wish.
What AudioManger can do for you:
1- Currently, Godot's native Interactive stream does not emit a finished signal. With the new classes AudioStreamPlus, AudioStreamPlus2D, AudioStreamPlus3D, and AudioMangerPlus along with AudioManger, this is now possible.
2- Version 1.x did not have support for web games, but now it does! If you mark the audio as looping now, it will behave on the web without even having to re-import the audio as looping. In other words, now you just need to mark in the Godot inspector that you want the audio loop, and it will work for the web as well.
3- Due to limitations for web games, the web javascript API kills game processing when it loses focus. That is, if you navigate outside the browser tab, it causes unexpected behavior. With this in mind, this version 2x now has the pause_onblur option, which, if marked as true, pauses the audio and emits a signal.
4- The plugin now has better performance. It has been completely rewritten. Therefore, use Godot 4.5x or higher.
5- Some native Godot features lack support for pitch scale and max polyphony in some audio files with playlists and synchronized audio. If you forget this, the plugin will warn you in the console.
The Audio Manager inserts audio files into the parent node for omni audio files (AudioManagerPlus), and for AudioManagerPlus2D and AudioManagerPlus3D audio files, you can choose the parent of each audio group in the inspector using the parent_2d and parent_3d properties. Once these properties are defined, the 2D and 3D audio files are reparented to these nodes, allowing you to take full advantage of proximity sound effects, for example.
Notes:
When using the pause_onblur mode, be aware that if you are running the game and change any properties in the inspector, the audio will pause, and you might forget about it. However, the plugin will warn you in the console that the audio has paused, so leave the console open so you don't forget.
Audio Manager Plus
Properties
| Property | Type | Description |
|---|---|---|
audio_name |
String | Unique name for the audio file |
stream |
AudioStream | Audio stream to be played |
use_clipper |
bool | Enable/disable clipper functionality |
start_time |
float | Start time in seconds when clipper is enabled |
end_time |
float | End time in seconds when clipper is enabled |
autoplay |
bool | Auto-play when entering tree |
loop |
bool | Enable loop playback |
volume_db |
float | Volume in decibels |
pitch_scale |
float | Pitch and tempo multiplier |
max_polyphony |
int | Maximum simultaneous sounds |
pause_onblur |
bool | Pause on browser tab blur |
mix_target |
AudioStreamPlayer.MixTarget | Audio mix target channels |
playback_type |
AudioServer.PlaybackType | Playback type override |
bus |
StringName | Audio bus name |
Methods
| Method | Parameters | Description |
|---|---|---|
play_plus(audio_name, from_position) |
audio_name: String, from_position: Float | Play audio stream |
stop_plus(audio_name) |
audio_name: String | Stop audio playback |
pause_plus(audio_name) |
audio_name: String | Pause audio playback |
unpause_plus(audio_name) |
audio_name: String | Resume audio playback |
add_plus(audio_name, audio_plus) |
audio_name: String, audio_plus: AudioManagerPlus | Add new audio |
remove_plus(audio_name) |
audio_name: String | Remove audio |
is_plus_playing(audio_name) |
audio_name: String | Check if playing |
is_plus_paused(audio_name) |
audio_name: String | Check if paused |
get_plus(audio_name) |
audio_name: String | Get audio stream |
get_all_plus() |
- | Get all audio streams |
find_plus_index(audio_name) |
audio_name: String | Find audio index |
has_plus(audio_name) |
audio_name: String | Check if audio exists |
get_plus_length(audio_name) |
audio_name: String | Get stream length |
get_plus_playback_position(audio_name) |
audio_name: String | Get playback position |
get_plus_stream_playback(audio_name) |
audio_name: String | Get stream playback |
has_plus_stream_playback(audio_name) |
audio_name: String | Check if has playback |
seek_plus(audio_name, to_position) |
audio_name: String, to_position: Float | Seek to position |
Signals
| Signal | Parameters | Description |
|---|---|---|
finished_plus |
audio_name: String | Emitted when audio finishes |
finished_plus_loop_in_clipper |
audio_name: String | Emitted when looped audio finishes in clipper |
pause_unpause_changed_plus |
audio_name: String, pause: Boolean | Emitted when audio pauses/unpauses |
Audio Manager Plus 2D
Properties
| Property | Type | Description |
|---|---|---|
audio_name |
String | Unique name for the audio file |
stream |
AudioStream | Audio stream to be played |
use_clipper |
bool | Enable/disable clipper functionality |
start_time |
float | Start time in seconds when clipper is enabled |
end_time |
float | End time in seconds when clipper is enabled |
autoplay |
bool | Auto-play when entering tree |
loop |
bool | Enable loop playback |
volume_db |
float | Volume in decibels |
pitch_scale |
float | Pitch and tempo multiplier |
max_polyphony |
int | Maximum simultaneous sounds |
pause_onblur |
bool | Pause on browser tab blur |
playback_type |
AudioServer.PlaybackType | Playback type override |
bus |
StringName | Audio bus name |
max_distance |
float | Maximum hearing distance |
panning_strength |
float | Panning strength multiplier |
attenuation |
float | Distance attenuation exponent |
area_mask |
int | Area2D layers affecting sound |
Methods
| Method | Parameters | Description |
|---|---|---|
play_plus2d(audio_name, from_position) |
audio_name: String, from_position: Float | Play 2D audio stream |
stop_plus2d(audio_name) |
audio_name: String | Stop 2D audio playback |
pause_plus2d(audio_name) |
audio_name: String | Pause 2D audio playback |
unpause_plus2d(audio_name) |
audio_name: String | Resume 2D audio playback |
add_plus2d(audio_name, audio_plus2d) |
audio_name: String, audio_plus2d: AudioManagerPlus2D | Add new 2D audio |
remove_plus2d(audio_name) |
audio_name: String | Remove 2D audio |
is_plus2d_playing(audio_name) |
audio_name: String | Check if 2D audio playing |
is_plus2d_paused(audio_name) |
audio_name: String | Check if 2D audio paused |
get_plus2d(audio_name) |
audio_name: String | Get 2D audio stream |
get_all_plus2d() |
- | Get all 2D audio streams |
find_plus2d_index(audio_name) |
audio_name: String | Find 2D audio index |
has_plus2d(audio_name) |
audio_name: String | Check if 2D audio exists |
get_plus2d_length(audio_name) |
audio_name: String | Get 2D stream length |
get_plus2d_playback_position(audio_name) |
audio_name: String | Get 2D playback position |
get_plus2d_stream_playback(audio_name) |
audio_name: String | Get 2D stream playback |
has_plus2d_stream_playback(audio_name) |
audio_name: String | Check if 2D has playback |
seek_plus2d(audio_name, to_position) |
audio_name: String, to_position: Float | Seek 2D audio position |
Signals
| Signal | Parameters | Description |
|---|---|---|
finished_plus2d |
audio_name: String | Emitted when 2D audio finishes |
finished_plus2d_loop_in_clipper |
audio_name: String | Emitted when 2D looped audio finishes in clipper |
pause_unpause_changed_plus2d |
audio_name: String, pause: Boolean | Emitted when 2D audio pauses/unpauses |
Audio Manager Plus 3D
Properties
| Property | Type | Description |
|---|---|---|
audio_name |
String | Unique name for the audio file |
stream |
AudioStream | Audio stream to be played |
use_clipper |
bool | Enable/disable clipper functionality |
start_time |
float | Start time in seconds when clipper is enabled |
end_time |
float | End time in seconds when clipper is enabled |
autoplay |
bool | Auto-play when entering tree |
loop |
bool | Enable loop playback |
volume_db |
float | Volume in decibels |
max_db |
float | Maximum sound level in decibels |
pitch_scale |
float | Pitch and tempo multiplier |
max_polyphony |
int | Maximum simultaneous sounds |
unit_size |
float | Unit size for attenuation |
max_distance |
float | Maximum hearing distance |
pause_onblur |
bool | Pause on browser tab blur |
playback_type |
AudioServer.PlaybackType | Playback type override |
doppler_tracking |
AudioStreamPlayer3D.DopplerTracking | Doppler effect tracking |
bus |
StringName | Audio bus name |
panning_strength |
float | Panning strength multiplier |
area_mask |
int | Area2D layers affecting sound |
emission_angle_enabled |
bool | Enable emission angle attenuation |
emission_angle_degrees |
float | Emission angle in degrees |
emission_angle_filter_attenuation_db |
float | Attenuation in decibels |
attenuation_model |
AudioStreamPlayer3D.AttenuationModel | Attenuation calculation model |
attenuation_filter_cutoff_hz |
int | Filter cutoff frequency |
attenuation_filter_db |
float | Filter attenuation in decibels |
Methods
| Method | Parameters | Description |
|---|---|---|
play_plus3d(audio_name, from_position) |
audio_name: String, from_position: Float | Play 3D audio stream |
stop_plus3d(audio_name) |
audio_name: String | Stop 3D audio playback |
pause_plus3d(audio_name) |
audio_name: String | Pause 3D audio playback |
unpause_plus3d(audio_name) |
audio_name: String | Resume 3D audio playback |
add_plus3d(audio_name, audio_plus3d) |
audio_name: String, audio_plus3d: AudioManagerPlus3D | Add new 3D audio |
remove_plus3d(audio_name) |
audio_name: String | Remove 3D audio |
is_plus3d_playing(audio_name) |
audio_name: String | Check if 3D audio playing |
is_plus3d_paused(audio_name) |
audio_name: String | Check if 3D audio paused |
get_plus3d(audio_name) |
audio_name: String | Get 3D audio stream |
get_all_plus3d() |
- | Get all 3D audio streams |
find_plus3d_index(audio_name) |
audio_name: String | Find 3D audio index |
has_plus3d(audio_name) |
audio_name: String | Check if 3D audio exists |
get_plus3d_length(audio_name) |
audio_name: String | Get 3D stream length |
get_plus3d_playback_position(audio_name) |
audio_name: String | Get 3D playback position |
get_plus3d_stream_playback(audio_name) |
audio_name: String | Get 3D stream playback |
has_plus3d_stream_playback(audio_name) |
audio_name: String | Check if 3D has playback |
seek_plus3d(audio_name, to_position) |
audio_name: String, to_position: Float | Seek 3D audio position |
Signals
| Signal | Parameters | Description |
|---|---|---|
finished_plus3d |
audio_name: String | Emitted when 3D audio finishes |
finished_plus3d_loop_in_clipper |
audio_name: String | Emitted when 3D looped audio finishes in clipper |
pause_unpause_changed_plus3d |
audio_name: String, pause: Boolean | Emitted when 3D audio pauses/unpauses |
Basic Usage Example
# Create AudioManager
var audio_manager: AudioManager = AudioManager.new()
# Create AudioManagerPlus
var audio_plus: AudioManagerPlus = AudioManagerPlus.new()
# Configure AudioManagerPlus
audio_plus.stream = preload("res://assets/audios/door.mp3")
audio_plus.use_clipper = true
audio_plus.start_time = 0.5
audio_plus.end_time = 1.2
audio_plus.loop = true
# Connect loop signal
audio_manager.finished_plus_loop_in_clipper.connect(func(audio_name: String):
print("Audio Name: %s" %audio_name)
)
# Connect finished signal
audio_manager.finished_plus.connect(func(audio_name: String):
print("Finished: %s" %audio_name)
)
# Add AudioManager to scene tree
add_child(audio_manager)
# Add AudioManagerPlus in to AudioManager
audio_manager.add_plus("door_open",audio_plus)
# Play AudioManagerPlus from AudioManager
audio_manager.play_plus("door_open")
Installation
- Download the plugin files
- Place the plugin folder in your Godot project's addons/directory
- Enable the plugin in Project Settings > Plugins
- Add the AudioManager node to your scene
Screenshots
Audio Manager
Audio Manager Plus 3D
Audio Manager Plus 2D
Audio Manager Plus (omni)
❤️ Support
If this project helps you, consider supporting:
https://github.com/sponsors/Saulo-de-Souza
https://www.paypal.com/donate/?hosted_button_id=G24W4KL9ALH64
Changelog for version 2.0.1
No changelog provided for this version.