Character Sound Implementation in UE4

Checked with: Version 4.6  05/01/2016

In this video we’ll create some character sounds in FMOD Studio and hook them up to character animations in Unreal Engine 4.

 

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

   

Transcript

(0:00) Hello and welcome to the FMOD Studio and Unreal Engine 4 tutorial series.

(0:07) Today we are going to be covering character sounds and working with character animations in UE4. In the last tutorials we implemented the multi track ambience and the twister sound.

(0:31) So your FMOD Studio project should have a few Environment sounds already. Create a new folder called character. Create three new events – vocalisations (vox event), a footsteps event, and we will have a breathing event too.

(1:17) Now, we will start with the footsteps event, and we will create a few tracks in this event. So we will create a “Step” track, we will create an “Armour jingle” track and we will also create a “Thud” track. With the footsteps event selected (in the Event Editor Window), we will grab the two armour jingle sounds from the Audio Bin and drag and drop them straight in to the “Jingle” track. Do the same with the leather armour sounds and footstep sounds.

Shift-select to create Multisounds for each element.

Shift-select to create Multisounds for each element.

 

(2:32) Now with these three sounds, they do not all need to happen at the start of the event, so create a little difference in timing between the start of each sound.

Scatter the start timings of each module a little.

Scatter the start timings of each module a little.

(3:09) Now we will create some modulation for each of these modules. So we will just add some random modulation for both the pitch and the volume by right clicking on the dials in the Deck area. Just three steps of pitch and three decibels of volume modulation is sufficient to create a little difference between each trigger of the sounds. And I will just do that the same way for each of the multi sound modules. You can add more or less, so have a greater range of pitch modulation and a greater range of volume modulation if you like.

Add Pitch and volume modulation to each module.

Add Pitch and volume modulation to each module.

(4:21) Excellent, so we will have a quick listen to these settings. Hit this button right up next to the transport control – the loop audition button and it just means that whenever the cursor hits the end of a sound region, it will just loop the sound around again.

Make sure your Loop Audition button is on.

Make sure your Loop Audition button is on.

(5:43) Once you have finished tweaking and designing that sound make sure you assign it to the Master Bank.

 

(5:48) And we will move onto the next sound – the vocalisations. This sound will be super simple – just name the track, bring up the Audio Bin, and we will select the files we want in the multi sound and drag them straight in to the track to create a Multisound.

Drag your vocalisation assets in to the Vox Event.

Drag your vocalisation assets in to the Vox Event.

(6:07) Again, a little bit of modulation will mean the player will be less likely to hear repeating assets. Maybe just a little bit less pitch modulation than before (3 steps), same amount of volume modulation (3dB). You can drop the pitch of the module as well if you like. Assign that one to a Bank.

Modulation settings on the vocalisation module.

Modulation settings on the vocalisation module.

 

(7:09) So in the breathing sound event, we will have two tracks, we will have the fast breathing and slow breathing, so we will just add in an extra audio track. Pop in the slow breathing and the fast breathing as the names of the tracks, and bring up the Audio Bin. Just drop the assets straight in to each track and pull the end of the fast breath to the right to create a repetition of the region. Create a loop region around the two repetitions of the Fast Breath.

Creating a loop region by right-clicking the module.

Creating a loop region by right-clicking the module.

(7:53) The next step is to add a parameter to this sound. What we are going to do is we are going to switch between the breathing assets based on how fast the character is moving – To do this, we will need a “Speed” parameter. Set the range of this parameter to zero and one (we are going to normalise the values we get from Unreal).

Add a

Add a “Speed” Parameter with a range of 0 to 1.

(8:27) To create the switching effect we want, we will automate the volume dial of both tracks. When the speed is slowest (lowest Speed value) we will hear the slow breathing asset, and when the speed is highest, we will hear the fastest breathing asset. Right-click and create volume automation on both of the tracks we have here.

Creating volume automation can be done by right-clicking the Track's volume control.

Creating volume automation can be done by right-clicking the Track’s volume control.

(8:55) Now in terms of this crossfade right here – the crossover slope should be created by checking the balance between the two sound assets and ensuring the volume stays similar across the two tracks. Aim to have two repetitions of the fast breath and one repetition of the slow breath, so that the fast breath sound most natural.

Completed automation of the two Breathing tracks.

Completed automation of the two Breathing tracks.

(11:25) Now, we have got sounds in all three of our events, make sure they are all assigned to the Master Bank. Build via the FMOD Studio/File menu, and we will get them all implemented into Unreal.

 

(11:48) Alright, so we will start by Implementing the character breathing sound. Locate the blueprint for the Heraklios character. If you recall from previous tutorials, can can use the Content browser search box. And the blueprint that I want to find is the ‘Mixamo_Heraklios’ blueprint.

Find the Heraklios Character Blueprint.

Find the Heraklios Character Blueprint.

(12:43) So, if we remember, if there is a sound we want to trigger and move around with the character, we need to add it as a component in the Components view. On the left hand side of your components view, add an FMOD Audio Component to the Character. We will type in the name, we recommend identifying your Sound Components with ‘sound’ on the end. Then, make sure that you assign the Event to this Component, by select breathing from the list, and make sure that this sound is set to “Auto Activate”. Hit compile and save so we can create the blueprint logic.

Breathing Component attached with details panel completed.

Breathing Component attached with details panel completed.

 

(13:14) And then we will head to the graph view.

(13:24) First of all, we will get a reference to Breathing sound component we just attached to our character. So we will get ‘BreathingSound’.

(13:38) We will drag out from the connector and when you release the mouse, you can search for the next component to use. If you type in ‘parameter, use the FMOD Set Parameter component so that we can set the parameter ‘speed’. Use the name of the parameter as it appears in FMOD; ‘Speed’.

You can get a reference to the Breathing Sound while you get the Set Parameter node.

You can get a reference to the Breathing Sound while you get the Set Parameter node.

(14:03) And then we will also need to tell Unreal to actually start calculating and setting this parameter. Every tick – whenever the game has started and time is passing – is when we are wanting to be updating this speed parameter. So I just typed in here to get ‘add event – event tick’.

To continuously update this parameter, we need the Event Tick.

To continuously update this parameter, we need the Event Tick.

(14:29) Connect the Event Tick to ‘set parameter’. This tells Unreal we want to update the Parameter ‘Speed’ every tick.

(14:41) So to do that, we are going to need to grab the character’s movement Component. This component calculates many different elements of the Character, so we need to extract the ‘velocity’ element. If you pull a connector off this module, you will have to scroll down the bottom or search to find ‘velocity’.

Find the Velocity of the Character using the Character Movement Component.

Find the Velocity of the Character using the Character Movement Component.

(15:17) Then, to normalise this value between 0 and 1, we will need to type in ‘vector length’, we need the ‘div’ type, because we will need to divide float by float. So we will need to divide the velocity by the maximum character speed.

To normalise the value, we need a Divide Float / Float node.

To normalise the value, we need a Divide Float / Float node.

(16:02) To get the max speed we use the Character movement component again, and pull the Get Max Speed module from this component

Normalisation requires the Maximum of the variable Velocity.

Normalisation requires the Maximum of the variable Velocity.

And then we will need to plug this return value (the max speed) into the denominator of this divide operation. This normalises the velocity that we have got here. And then we will be able to plug that into the Value field of the Set Parameter module. Make sure you compile and save before trying to audition this sound.

Completed Blueprint logic for the Breathing Sound.

Completed Blueprint logic for the Breathing Sound.

 

(16:44) At this point, you can head back to studio and revise the sound if you need to. We add six decibels to the Master.

 

(17:57) Next up, we will implement the Footstep sounds.

(18:02) Close off the ‘Mixamo Heraklios’ blueprint, and Open Heraklios’ Animation Blueprint. Search ‘AnimBlueprint’ – just from the Content Browser.

Open the Animation Blueprint for the Heraklios character.

Open the Animation Blueprint for the Heraklios character

(18:20) The animation blueprint contains all of the behaviours of the character – the character movement behaviours, animations, particle effects and so on. It also contains all of the meshes, skeletons and also blending between the animations. This is helpful for us because we can trigger sounds from the animations.

(18:37) Open the Walk animation. When we open an animation, we can play and view the animation of course, but what we want to do is place “notify events” on the timeline of this animation. Which will let us trigger a sound when this notify event is played.

(19:13) So what we are going to do is we are going to right click and select ‘add notify’ and then ‘FMODPlayEvent’.

Adding an Animation Notify Event to the Animation Blueprint.

Adding an Animation Notify Event to the Animation Blueprint.

(19:27) Drag and drop the Anim Notify to the correct timing – you want to find the point where the character’s foot impacts on the ground.

Adjusting the timing of your Notifies is a quick process.

Adjusting the timing of your Notifies is a quick process.

(20:19) Then repeat this for every footdown in the animation cycle. Now, if we press play, we will hear that nothing happens yet. This is because we have not actually told Unreal to do anything with these notify events just yet. To play an event, simply select the FMODPlayEvent notifies and select the Footstep event in the details panel on the Right Hand Side.

Apply the Footstep event for automation trigger of that FMOD event.

Apply the Footstep event for automation trigger of that FMOD event.

 

This document has been updated to reflect the new, more efficient workflow. The video covers the old Anim tagging workflow that requires extra Blueprint coding to work. This is not necessary if you use the new FMOD Anim Notify events as instructed.

(25:06) So if you were applying these edits for the Vox sound as well you will be ready to listen to your tagged animations in game. And if we jump into Play mode, we can walk, run and jump around we will hear the footsteps and vocalisations.

 

(25:32) Now what we might do quickly is live connect to UE4 from FMOD to set the volumes of these sounds. You can do this by opening the FMOD Studio/File menu and selecting ‘Connect to game’ and using the ‘local host’ setting will work if you are running the game locally on your computer.

Connecting to a game run on your computer can be done by connecting to localhost.

Connecting to a game run on your computer can be done by connecting to localhost.

(26:07) Once you have connected to the game, you can run around in the game and then use the FMOD Event Editor window to set the Master volume of each event. This allows you to do a mix of the game so that your sounds are balanced. You can use the Mixer Window to balance between groups of sounds as well.

When Live Connected, your windows have a red border and live metering is visible in the Mixer.

When Live Connected, your windows have a red border and live metering is visible in the Mixer.

 

(26:57) Alright, so we have gotten all of our animation and character sounds implemented on our character.

(27:34) In the next tutorial, we will look at how we trigger snapshots for Mixer States and how we use snapshots to trigger Reverberation as well.

(27:42) So we will see you again next time.

 

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.