Download

Interactive, Adaptive Music?

Hey everyone!

So most modern video games have adaptive music. Basically what I am saying is that the music has multiple tracks that are toggled on and off depending on what is happening on screen, with cross fades or stingers to mark the changes between overlapping music tracks.

Is there a way to do this in Unreal 4? If so, how would I go about doing this?

In the upcoming Landscape showcase for 4.2 I set up adaptive music that fades between two tracks based on your location in the level, fading from an upbeat version of the music to a quiet, more atmospheric version. The two music tracks are in a sound cue, and their respective volume levels are faded in an out by a float parameter being set in the level Blueprint.

The sound cue for the music looks like this:

The continuous modulator nodes can change the volume and pitch of a sound based on a float parameter, so the top one is set up to fade the volume from 1 to 0 as the parameter increases, while the bottom one fades from 0 to 1. The mixer node just adds the two sounds together.

In the level Blueprint, the parameter is being set for the sound actor like this:

I left it out of the screenshot because it’s not strictly relevant, but the music fade value is being set according to the player pawn’s Z location normalized to a range (so you get a result going from 0 to 1). The fInterp node is used so that the float parameter updates smoothly instead of suddenly popping from one value to another, which would sound jarring.

This particular setup is for two versions of a music track that need to sync up precisely, but there are a few other ways you might manipulate music and other sounds with Blueprints too - it just depends on your needs.

Alright, this should be enough to get me started, thank you!

StevenWaltherMedia, not about UE4 (UE3 wwise for Remember Me), but maybe you’ll find these links a little bit helpful:

Plus check this book, it’s really cool and it uses UDK as an example (same again, not UE4, but principles are the same, I think).

BTW, wwise have a free limited licence option + UE4 integration.
And a very good tutorial — Wwise Project Adventure

The original unreal and unreal tournament could use tracked music (look up skaven/purplemotion and screamtracker/modplug tracker) in which a scripting systems was how the music was created, this allowed for all of a game’s music and soud fx to be contained within one file and played only when needed, you could also blend across multiple ‘sets’ of music or just jump one to the other if the inclination took you. The advantage of this type of music is it could adjust tempo and speed on the fly and if you organised your pattern (one little section of the music) well you could put possible bridges and change-music sections in to seamlessly change from one piece to another without the fading. I’m not sure if the implementation of being able to use these type of files is still available but it would be cool.

There’s a cross fade by parameter node in the Sound Cue editor but I didn’t see how I could possibly set which parameter to use. Or is it better to use that modulator set up?

I’d like to fade 1 BGM into another much like many RPGs switch from exploration to battle music if an enemy gets close to you.

Errr…Never mind, it looks like that modulate set up does what I need. Thanks!

Thought it’d be worth mentioning that there is a Kickstarter live right now that is seeking to produce a large selection of music designed for use in the context of adaptive music. It may or may not help but here is the link : Link to the Adaptive Music Resource

As far as using the content goes, I would imagine it could easily be triggered via an event system using the transition clips to link up between the other music files.

Hi Thomas,

Trying to get more into implementing music in UE4, could you please expand on how to use interpolation? I’m trying to implement a layered cue where the high intensity gets triggered by a trigger box in the level.
All my nodes look pretty much the same as yours but I get lost when it comes to the Finterp. Any info would be much appreciated!
Thanks