Unreal Engine Part 10: Adding sound
In chapter 10 of Rob Redman's comprehensive video introduction to Unreal Engine, we look at adding atmosphere and effects through sound design...
Previous tutorials
Part 1: Setting up a new project
Part 2: Introducing materials and landscapes
Part 3: Adding foliage and rocks
Part 4: Particle smoke
Part 5: Introducing the skybox
Part 6: Setting up cameras and post-effects
Part 7: Teleporters
Part 8: Adding random assets
Part 9: Destruction
Sound is a vital element of many experiences and although many people don't think about it, you would notice if it wasn't there, and with that in mind it's about time I show you how to add audio to your levels. There are many controls and options to working with sound files in Unreal Engine, but we will concentrate on a triggered method, so that when our actor/player moves into a defined zone the audio will play. This is a fantastic way of supporting the narrative and helping the player understand what is happening, or may be about to happen.
I've included the audio file here but feel free to ignore it and use your own.
Download here
Step 1: Importing audio
With your level open, go to your content browser and add a new folder. Name it audio, then open it up and click import, navigating to the audio file.
If you double-click the icon you will see a few base settings. Make sure looping is turned off then close that window.
Step 2: Cueing
Right-click on the icon for the audio file and select Create Cue. A new object will appear. You can rename if you like but the default is fine. Double-click this to open up the editor. On the right you will see a number of nodes that can be added. We will want some attenuation but close this window down and we will deal with that another way.
Step 3: In-level attenuation
Drag the cue object into your level and place it so it sits in the middle of the zone you want it to be heard in. I chose just in front of the statue.
Now in the details section choose to override attenuation and you will see visual feedback on the min/max areas for the volume to be heard.
If you play the level you will hear the audio play once but it's not sparked by an event, so we need to fix that (unless you want sounds playing all the time). Finally make sure you uncheck AutoActivate.
Step 4: Trigger event
Although there are times when you don't need triggers, it will be better for us to use one, so add a box trigger to the same location as the cue. These are in the basic section of the objects menu. Use the details section to scale the box to 3 in each axis.
Step 5: Blueprinting
With the trigger selected, open the level blueprint and the editor will open. First up we need to link the cue to an event (our trigger volume) so right-click and add an onactorbeginoverlap node, along with a play node. Also drag your audio file from the outliner into the node editor. Connect them up as in the image, hit compile then exit the editor. Now, when you play the level and move into the volume specified by the box trigger, the sound file will play, with a nice fade in/out as you move through the attenuation space.
Top tip: Pockets of sound
You can have localized sounds playing for players to walk into by following steps 1-3 and turning looping on.
Related links
Download Unreal
Grab a copy of 3dtotals Unreal Game Engine tutorial book
Previous tutorials
Part 1: Setting up a new project
Part 2: Introducing materials and landscapes
Part 3: Adding foliage and rocks
Part 4: Particle smoke
Part 5: Introducing the skybox
Part 6: Setting up cameras and post-effects
Part 7: Teleporters
Part 8: Adding random assets
Part 9: Destruction
Fetching comments...