Dynamic music for games

Godot Version

4.2.1

Question

How do someone make a Dynamic music in the game? like in the sonic adventure 1 or DMC 5, the music is always there but when you get a S, the lyrics come up. I have made a music, first half is normal but second half is scary I guess. now I want the normal half to play on the background but, for example, when the player enters an area2d, the second half plays. is there any command for it or should I just cut the music in 2 halves?

I think the easiest would be if you cut your song into 2 parts:

  1. first part which can be looped and this would just play on a loop in the background
  2. second part which would be triggered in some areas. Ideally if this is just an overlay on top of the first part, so you can just start playing this part without removing the first part.

Check out how Ovani Music did this with their Godot Plugin, the concept is very similar to what you want to achieve.

thanks

Fmod is designed for this kind of need but it come with a licence fee.
There’s a fmod godot plugin https://github.com/utopia-rise/fmod-gdextension and fmod’s own examples illustrate this idea pretty nicely.
I don’t suggest coding this yourself unless you only have one specific song in mind and it could be hard-coded.

is it compatible for Godot 4.2.1?

There is also AudioStreamInteractive starting from Godot 4.3

You could achieve something somewhat similar by playing multiple AudioStreams at the same time and playing with volume, but it might not sound completely synchronized.

You will probably prefer the above propositions from other posters

github page says there are compatible with all 4.x versions

upgrading the engine is not an option, 60% of the game is done and updating it would bring some bugs, such as tilemap and animation bugs.