Background Music Zone Best Practice

Hi, I’m wanting to find out what the best practice is for setting up background music zones within a map. I’ve looked through a few tutorials and read some docs, and sort of got some ideas of how this can be done. But I’m trying to find out if there’s something along the lines of a generally accepted standard way of doing this which keeps everything as simple and tidy as possible.

So what I want is just the basic thing where a character walks into an area and a music track starts playing and continues to loop while they’re in that area, and then when they leave that area it fades out and stops. Maybe in some cases with the option to fade in when entering the area, but for now I mostly want the track to start at full volume when entering.

Should this be done with an audio component placed on the player, with triggers linking to a blueprint to change the clip and manage fading etc? Or is there a simple way to do it using Audio Cues dropped into the scene? Are there any tutorials that show what’s considered the industry standard method?

Hi Lysergy!

The beauty, in my opinion, of designing interactive music systems in UE4 is that you can build whatever fits your game!

There are no industry standards for interactive music, but what you propose is one of the most basic designs.

My recommendation is to yes, use an Audio Component so you can manage volume levels throughout its lifetime.

You can also use a Timeline Float Curve to create custom fade shapes and to trigger fade ins and fade outs as needed. I encourage exploration! :slight_smile:

Thanks Dan, I agree that the flexibility of UE4 is part of what makes it awesome! Though it can also mean us noobs can end up setting things up in ways basically work but aren’t always optimal, e.g. using features for purposes that they weren’t designed for when there is another one that would be better suited, so examples of how best to do common tasks are always handy.

Anyway looks like there are many hours of fun to be had experimenting with the audio system and as a musician I’m looking forward to understanding it enough to use it creatively. I’ve managed to get some basic music zones going now and will look into using the timeline to manage the fades.

1 Like

even easier would be to use a trigger/collision box and in level BP:

-> On enter fade out environment sound, fade in area sound
-> On exit, fade out area sound, fade in environment sound

This is the basic, after this, you’ll start on using envelopes and those whatcha-ma-callits that all the environment sound to be “occluded” and faded while the area sound is playing (this is more for ambient sound effects rather than music). For music, the above should work fine.

@dan.reynolds Mmm, that reminds me, while I haven’t looked for one, is there an Audio Cross-Fade node in normal blueprints?

Depends on what you’re trying to achieve. Are these synchronized? If so, then you’d set both to virtualize when silent; play both at once (on the same frame); one starting at 0.0 volume and the other at 1.0 volume; then modulate the volume as needed.

If you’re using the old audio engine, you’ll need to do this in SoundCues if you’re using the new one, you just need to make sure that the play function for both soundwaves are executed on the same frame.

1 Like