Sounds and Components in UE4

Checked with: Version 4.6  04/01/2016

In this video we’ll create a multitrack ambience and use sound emitters in UE4. We’ll also create a 3D point source and hook that up using Blueprint.

 

Download FMOD Studio for UE4 and the tutorial assets from the Downloads Page

   

Transcript

Hello everyone, welcome to the FMOD Studio and Unreal Engine 4 video tutorial series

Today we are going to go and jump into the second video in this tutorial series, where we are going to look at creating and implementing a basic ambience and creating and implementing a basic 3D sound.

(0:20) Now I just want to quickly recap on some things we would have covered in the first video. We have installed the FMOD Studio plug-in in Unreal, we have opened up our project in Unreal and we have created our project in FMOD Studio. Additionally, we have set up our Preferences for building from FMOD – to building into the content folder of our Unreal project.

So if you are all ready to go, then let’s jump straight into it!

Now, to make finding our assets easy throughout the whole tutorial series, we will import them all at the same time.  To do this, we can open the Audio Bin window and work in this window.

Import all assets at once by dragging and dropping in to the Audio Bin.

Import all assets at once by dragging and dropping in to the Audio Bin.

 

(2:00) Select all of these assets and drag and drop them into our Audio Bin, and FMOD will store all of these assets in the asset folder, ready to go for whenever we need them.  Now, the Audio Bin is a browser window of our assets that are added into the FMOD Studio project and this allows us to organise these files within the FMOD Studio context.

(2:16) The Audio Bin also allows us to search within FMOD Studio, instead of within Explorer, for the assets when we need to add them in to Sound Events in the Project.  We can also create a hierarchy, or folders, organise the files, put all of the environment assets in the environment folder put all of the truck assets in the truck folder, so on and so forth.

Sorting assets in the Audio Bin can be done by dragging and dropping.

Sorting assets in the Audio Bin can be done by dragging and dropping.

 

(3:03) So, what we might do now is back in the Event Editor window, we will start creating events.

(3:08) We are going to make an “Ambience” event and a “Twister” event, but first, Right-click and create a new Folder called “Environment” and then we can Right click and create these new events in the folder.  So name the first one “Ambience” and then we will right click, add new event and name the second one “Twister”.

Creating a new folder or event can be done by right-clicking.

Creating a new folder or event can be done by right-clicking.

 

(3:31) Now one thing I like to do as I’m creating events is assign them to the Master Bank right away. Doing this right away means that when we build our Banks, these events will be bundled in to the Bank right from the beginning.

Saving your banks for UE4

Assign your events to your Bank right away by right clicking.

(4:05) Now what we will do is open the Ambience (selecting will open the sound) and start designing that sound.  So the first track we will re-name to ‘Wind bed’. 

Rename your tracks by double clicking.

Rename your tracks by double clicking.

(4:09) We will open up our Audio Bin Window so you can control + click and we will grab this ‘ambience sannohe forest winter air’ file and drag and drop it straight in to the track.

Saving your banks for UE4

Drag and drop assets straight in to the target track.

(4:26) We will drag out our birds eye view here so we can see the whole file.

Resize the birdseye view to see the whole module.

Resize the birdseye view to see the whole module.

(4:30) Right click and make a new loop region, to make it a looping sound.  You can listen to it if you like, I can guarantee you it is going to sound windy.

Create a loop region by right-clicking the module.

Create a loop region by right-clicking the module.

(4:45) Now, what we will do is we will (right click and) add an extra track on top of our bed, and we will call it ‘wind accents’.

Add a track by right-clicking on the Track Header.

Add a track by right-clicking on the Track Header.

(4:55) Now with this one, instead of making a single track or a multi track, we are going to make a ‘scatterer’ sound event by Right-clicking on the timeline.

Right click in the track to create a Scatterer Sound Module.

Right click in the track to create a Scatterer Sound Module.

(5:06) Drag that one out to make the module length longer.  If we click on the sound, and hit this other tab right down the bottom of the screen that says ‘scatterer sound’.  The deck area is contextual, based on what you click on, whether it is the track or the region itself.

The scatterer deck area is visible when you select the module on the timeline.

The scatterer deck area is visible when you select the module on the timeline.

(5:19) In the playlist, what we can do is you will right click and hit ‘add Event Sound’.

Add an Event Sound by rick-clicking in the Playlist.

Add an Event Sound by rick-clicking in the Playlist.

(5:24) Double click on it and it will open up the event sound nested inside the Ambience, right here.  Now, I think you will understand the reason we are doing this as soon as I show you what I am going to do.  So we will open the Audio Bin, and I will grab this ‘howling loop’ right here, drag and drop it straight in to our Event Sound.

Drag the asset from the Audio bin to the Event Sound Track

Drag the asset from the Audio bin to the Event Sound Track

(5:42) Now what I want to do with this ‘howling loop’ is create a fade in and a fade out around it.  I want to do this in an Event Sound as opposed to in the Ambience Event itself, is that if I drop in this the loop sound and create a fade, it will be time locked to between zero and ten seconds or zero and twelve seconds, however long the event is.  If I create this automation on the Event Sound in the event, whenever it triggers it will have that natural fade in and fade out which is what I am looking for.

(6:18) So I will right click and add automation on the dial, the volume dial right here and then I will just quickly click on the automation curve, which shows as the red curve in the track’s lane.  And it’s not so important how long the fade in or fade out is, you can set this up to being what you really think sounds best.

Completed automation after right-clicking the automation dial.

Completed automation after right-clicking the automation dial.

(6:47) Now jump back into main Ambience event, and right click and rename the Event Sound we just created, so we will call it “Howling”.

Saving your banks for UE4

Rename the Event Sound by right clicking the Playlist entry.

(6:56) Now, do the same with the “Whistling” so create Event Sound, and we will rename this one ‘whistling’ right away.

(7:06) Double click on it to open, open the Audio Bin, grab the “whistling” asset, drag and drop the asset straight in to the track of the Whistling Event. Now, we can create automation just like in our Howling event.

(7:24) Jump back into the ambience sound and there we are, ‘howling’ and ‘whistling’ Event Sounds in our Scatter Sound Events. Now with the wind accents track we have created a scatterer sound there instead of a multi sound.  A scatterer sound allows us to apply a Time interval between instances, and the ability to Scatter the placement of these Howling and Whistling accents over a Spatial range as well.

Right-click on the Track Head to add a new Track.

Right-click on the Track Head to add a new Track.

(7:30) So we want the Spatial range to be the range in which we want these Event Sounds to trigger, maybe the maximum to be 200 meters away and the minimum to be 50 meters away.

(8:29) Now, a scatterer sound module also lets you trigger more than one instance from the playlist at a time – the Polyphony setting will let us do this. Let’s set this to “three”.

(8:44) A Scatterer sound allows you to apply volume and pitch randomisation as well – a realistic amount of variation range would be about minus three dB and pitch maybe three semitones.

(8:54) The ‘Total number of sounds’ setting – you can set the triggering of sounds to stop once a target number has been reached. Because it is just wind, wind goes all the time, and our event will be looping endlessly.

Completed Scatterer Sound Settings.

Completed Scatterer Sound Settings.

(9:05) And then we can actually have a listen to see what that sounds like.

(9:12) Just turn that one down.

 

(9:22) Now, we will add another two audio tracks for our ambient Birds and Dogs.  Double clicking on each track name will let you rename, and adding new tracks can be done by right-clicking on an existing track head.

(9:39) Now for these Birds and the Dogs tracks, we will create a Scatterer sound in each track.  Open the Audio Bin, we will grab all of our birds, ‘Apostle birds’ and ‘Australian ravens’ and we will just drop them straight in the play list there.

Dragging the assets from the Audio Bin to the Playlist.

Dragging the assets from the Audio Bin to the Playlist.

 

(10:01) The dice here tells us that the playlist entries are going to be selected randomly, as opposed to stepping through the list.

(10:09) Next, we set the Time interval – we recommend 500 milliseconds, maybe up to six seconds.

(10:20) And then minimum and maximum scatter distance, We will set those up as being between 50 (minimum) to 100 units maximum.

(10:33) And for the Polyphony settings maybe only four birds at a time is appropriate.

(10:45) Again, I like a little bit of Volume and Pitch randomisation when I have so many sounds triggering in an ambient sound – about 3 steps or decibels is usually subtle and effective.

(10:54) For the Total sounds settings – we can leave this one, as our Ambience sound will be looping endlessly so we would not want the birds to suddenly stop.

Completed Scatterer Sound settings.

Completed Scatterer Sound settings.

 

(11:03) Now, for the Dogs Track and module, we can open the Audio Bin Window and just grab the dogs.  Some African wild dogs… Drag and drop these assets in the playlist of the Scatterer sound module.

(11:17) And then for the Scatterer sound, let’s set up the behaviour of this module. The Volume and pitch Randomisation settings can be similar to the Birds module – we set that one as 3 steps of pitch modulation and 3dB of Volume modulation.

(11:30) For the Polyphony settings, we need to consider how many dogs we think is appropriate barking at the same time.

(11:34) For the Temporal Intervals on the Left hand side – a maximum of 6 seconds, down to a minimum of 1.5 seconds between each trigger of a dog sound.

Distance Intervals can be similar to the Birds module as well – 100 units up to 500.

Completed Scatterer Sound settings for the Dogs.

Completed Scatterer Sound settings for the Dogs.

 

(11:57) We’ll audition this sound and experiment with the settings to see how changing these settings impacts on the sound.  So I’ll hit play on this, I might just even solo the dogs.

(12:20) When we drag this minimum temporal interval towards the right, they trigger more and more sparsely.  If we drag it towards the left, the interval gets shorter.  But remember that the interval is between 82 milliseconds and up to six, so if we pull them over towards the left together, the dogs will spawn very very often. We can set this back to about 2 seconds if you liked the original settings.

(14:15) What I am going to do now is have a listen to this sound within the context of the game.  So to do that, remember how we assigned the Bank?  Well now we actually have to build the Bank, so we do that; File – Build.  We should also remember to save our work.

Building your Banks is done through the File, or FMOD Studio menu.

Building your Banks is done through the File, or FMOD Studio menu.

 

(14:33) Jump straight into Unreal, and navigate to the Ambience sound in the Content Browser in Unreal. Usually this is in your Content > FMOD > Events folder.

Finding the Content Browser in UE4.

Finding the Content Browser in UE4.

 

(14:44) Now with an ambience sound, we want this sound to be a 2D, static ambience sound.  This ambience sound is a two dimensional sound, so we can drop this anywhere we like in the world we do not want to be able to localise this sound to any one location.  Eg, we do not want the wind to always sound like it is coming from the left hand corner of the game.  If we set this ambience as a 2D sound, it will just to gently surround you from a distance at all times.

(15:13) Back in FMOD Studio, now to do that we need to make sure that this ambience sound is a two dimensional sound. Having a 3D panner on this event indicates that it is a three dimensional sound.  So if we click on the Master track of the Ambient Event, and in this Master tab in the Deck area, seeing the 3D panner here, see that we cannot select in the Event Macros tab, but if we make sure that we have the Master tab selected, we can select the 3D panner and then just delete it.

Deleting the 3D panner will turn our sound 2D.

Deleting the 3D panner will turn our sound 2D.

 

(15:42) We will just quickly save and build that again.

(15:49) Now we will open the FMOD folder in the content browser here, open the events folder, and then we will navigate all the way down to our Ambience sound.  We can drag it and drop the Sound Event straight onto the ground.

You can drag the Event straight in to the Level.

You can drag the Event straight in to the Level.

 

(16:06) It’s good practise to lift your sounds just slightly off the ground. This does not impact on how this 2D sound plays, it is just so that you can see it resting on top of the ground there.

Use the arrows to move the sound emitter on that axis.

Use the arrows to move the sound emitter on that axis.

 

(16:15) If you tend to forget where things are placed, you can use the World Outliner to search for whatever the name of the sound is. And you can find that sound in the List, or in the level if you double click on it.

Search for the emitter name in the World Outliner.

Search for the emitter name in the World Outliner.

 

(16:44) For our Ambience sound, we need to set one setting in Unreal before it will play the way we want it to. Open up the details panel and just make sure that Auto Activate is selected.  That will mean that the sound will start playing as soon as we hit play to play the game!

The Details panel gives you access to the settings for the Emitter.

The Details panel gives you access to the settings for the Emitter.

 

(17:06) You will notice that, that wind sound does not pan when we look around.  This means that deleting the 3D panner has made the sound a 2D sound. It also means that we will get no distance attenuation as we run towards or further away from that location that we placed our Ambience sound in the level.  We can here the birds going, we can hear the dogs going, wind accents and the wind bed as well.

 

(17:36) Now, the next step is to jump back in to FMOD to design the Twister sound.  Then we will implement this sound in the game and then that will be all for this tutorial.

(17:57) Start by naming the first track of our Twister event – ‘Hi Wind’.  I am going to open up the Audio Bin and search for the assets (just by searching “twister”), just going to drag and drop the High Wind asset into the track.

Dragging the Twister asset to the track.

Dragging the Twister asset to the track.

 

(18:14) Right-click the newly created region to create a looping region around it.

Selecting the region will allow you to make a Loop Region of the perfect size.

Selecting the region will allow you to make a Loop Region of the perfect size.

 

(18:24) Let’s set up our sound’s 3D Attenuation Settings.  The minimum and maximum distance, this essentially tells us how big the sound is.  The minimum distance is the distance where the attenuation curve that you select in the graph starts to take effect.  The maximum distance is where the lowest point of the attenuation curve is reached, or in this case, this curve attenuates all the way down to silence, or zero decibels.

(18:29) So, a sound source size of one unit and for the sound to be totally silent at 20 units is probably a little bit small for a twister.  So what we will do is actually, we might make the minimum distance 20, the maximum distance 300 – our Twister is a really big sound.

3D Panner settings for the Twister sound.

3D Panner settings for the Twister sound.

 

(19:27) The rest of the sound design we will cover in the next Tutorial, we will actually go through in the next video, but setting up the sound quickly like this gives us something to experiment with.  So now that we have a sound ready to do, we can double check that it is assigned a Bank.  Save and build, and we then we will jump back into Unreal to implement it.

 

(20:03) Now select the Twister Object in UE4 – either by navigating to it in the Viewport, or selecting it in the World Outliner. 

(20:15) To attach the sound to the twister, we have to open the Twister’s blueprint. Now with Blueprints, Blueprints are a visual scripting feature that is nestled either within the level, actor or animation in your Unreal project. Blueprints allow you to create logic for behaviours, chains of events, or set parameters and variables during runtime in your game.

(20:45) With Blueprints, there are three different types of Blueprints that can be used to attach and control your sounds, and can either attach a sound to the level blueprint – to play when the level is activated. Sounds can also be attached a sound to a class blueprint and have it attached to, maybe something like a car, or a grenade, or a character.

(21:07) And then you could also use an animation blueprint, if the sound needs to be attached and triggered by an animation. The animation Blueprints also have instructions for how the characters’ animations blend between each other, as well as much more.

(21:28) So, what we will do, because we want the sound to move around with this twister (maybe one day we will decide that the twister will actually be able to roam around the level and we want the sound to follow it) we will open up the Twister blueprint.  We can do that one of three ways;

  • We could open up in the World Outliner, right click on the Twister and press ‘edit Twister BP’
  • Opening a Blueprint via the World Outliner.

    Opening a Blueprint via the World Outliner.

  • We can also hit the Blueprints button up in the menu, and then search for the class blueprint that we are after
  • Opening a Blueprint via the Blueprint button.

    Opening a Blueprint via the Blueprint button.

  • Or in our Content Browser, open Content > Blueprints, and we will see the Twister blueprint right there
  • Opening a Blueprint via the Content Browser.

    Opening a Blueprint via the Content Browser.

 

(22:26) When you open a Blueprint this opens to the Event Graph. The Event Graph is the screen where you can key off a number of different behaviours in a row, set or get parameters, and define other logic for your sounds.  But, say if you wanted a sound to be a part of that object, a part of how it works, we have to actually attach it as a component.

Opening the Viewport

Opening the Viewport.

(22:50) Now if you hit the Components button up the top, and this opens the screen where we can attach our sound to our twister in the Viewport. 

(23:02) We see a Components section on the left hand side, and we need to press ‘Add Component’.  Search for the FMOD audio component from the list, and this gives us an FMOD audio component item that appears in the Viewport.

Adding a Component to a Blueprint.

Adding a Component to a Blueprint.

(23:30) In the details panel, name the sound “TwisterSound”.  Then, in the sound section, and where it says event (which refers to FMOD event), select the Twister sound event from the drop down list.

(23:57) Then, to make sure that the sound actually starts playing when this actor is spawned, make sure that Auto Activate is checked.

The Auto Activate Setting in the Details Panel

Completed Settings, and the Auto Activate Setting in the Details Panel.

(24:04) To hear you changes, hit ‘compile’, then hit save, and then, if we hit play you’ll hear the sound.

Compile button in the Blueprint Window

Compile your changes to see them in game.

(24:23) Now you can hear that this wind sound pans from left to right, when we pan around with the camera.  And if we run towards it, it will get louder.  If we run away from it, it will get quieter.

(24:51) In the next tutorial, we will flesh out the Twister sound a bit by adding a few more tracks, panning and mix effects

(25:08) So hold on for that one, that tutorial that is coming up next.

 

Credits and Attribution

Assets in the asset pack are provided by the Sound Librarian, Soundwave Concepts, Mixamo, Epic Games and Sally Kellaway by herself at Firelight Technologies. Please refer to the Read Me document for further information on licensing, attribution and commercial distribution.