#AudioManager

1 messages · Page 1 of 1 (latest)

upbeat egret
#

How do you implement Audio in game? Is good idea to make some AudioManager as singleton or not? And why?
If somebody has your own audio manager and want share it for inspiration, it will be great.

cursive musk
#

I personally have written a small AudioManager that manages the volume settings and typical sound effects. Level music "subscribes" to it so I can easily blend it over

#

I usually have my managers as a child node of my main GameManager which is a singleton, so I only need one and can access all managers (audio, level transition etc)

upbeat egret
cursive musk
short kestrel
#

I would say having a global audio manager being a good idea depends on your game
If you only ever need to play sounds non-positionally it could be a good idea to make one

In my case I only have an autoload for a music player, since usually multiple music tracks do not play at the same time

#

while having separate audio systems that can get created for a player character and so on

cursive musk
#

Definitely a good idea for things like UI sounds

edgy vapor
cursive musk
solar trail
distant sonnet
#

I like to have a function for play(sound_name, position) and have a player be instantiated and freed automatically

#

I get a lot of use out of it for fast lazy implementation

upbeat egret
#

Thank you guys. If someone can share his manager or at least basic part of it, It help me a lot.

potent iron
# upbeat egret How do you implement Audio in game? Is good idea to make some AudioManager as si...

Singletons are great for audio for reusing audio streamers... but it's not the performance I care about, it's about knowing when these streamers were previously used because audio overlapping is a serious problem and if not managed can create some ear piercing sounds when too much is happening. So, having them managed in a singleton allows you to keep track of when these streamers were played previously.

#

Godot actually does have options per streamer to prevent such overlap, but you can always handle it more discreetly yourself.

gusty minnow
#

Using an autoload/singleton music manager as well primarily so the music is consistent and keeps playing between scenes.
Also in my case the music is adaptive to the gameplay so theres 2 Audioplayers that will play prerendered music samples with one volume off the other on, so I can tween between them (at the beat cue) so that the transition is smooth and happens over some time.
I guess similar as to @cursive musk

For audio effects I have another Audio Manager where you can just queue/register a sound effect to which then has a pool of audio players to use, but I dont have to worry about the specifics.

#

If you want "nice" transitions I ported StefanoPizzolato's GodotWebAudioEngine to godot4 btw. Its like an FMOD light for Godot: https://github.com/graphific/GodotWebAudioEngine letting you transition between music samples only on the beat, or at the end of a bar

lunar star
#

Adding to these answers, I think having an autoload/singleton for music is very common. I've seen it in other projects, a well-known template for game jams, and I wrote my own simplified audio/music manager singleton that I use for dynamic music

gusty minnow
#

Actually just saw this which makes all of the transition stuff you'd build yourself or use FMOD or WWISE for possible with 3 new audiostreams in godot 4.3: https://github.com/godotengine/godot/pull/64488 gdhearteyes
Might not include the switching on the beat etc but is a good start of any adaptive audio system.