After adding sounds of gunfire and ambience to our Chinese garden level in the previous chapter, we now move towards adding sounds of footsteps and foley to the first-person player character.
Take a moment to listen to the audio files located in the chapter_02 folder of your chosen middleware implementation, located within the Audio Showcase assets' installation directory. The files c_player_fts_wood_01 - 03 (or Play_c_player_fts_wood_L/R, if using SDLMixer) are sounds for footsteps, while c_player_foley_leather_long_01 - 03 (or Play_c_leather_long, if using SDL Mixer) can be used as foley for the player character's leather outfit.
Player Character
In this chapter, these audio files will be added as sounds and foley to the player character's footsteps via your choice of middleware implementation and the Character Tool.
The FMOD workflow of this chapter is also covered in the following video:
Three events need to be created and added to our first-person character:
To do this, as in Chapter 01, the audio files need to first be added to FMOD's Audio Bin.
Import Animation
While the foley sound in this tutorial plays in the center of the stereo panorama, it's more appropriate to hear the c_player_fts_L event on the left and the c_player_fts_R event on the right, since they correspond to the left and right footsteps respectively.
To position the sounds of these two Events:
Inside the Spatializer, click the button and turn the Mix knob in the Pan Override section all the way to 100%.
When the Mix knob is set to 100%, FMOD only takes the sound positioning defined in the Pan Override section into account; the position set by the Game Engine is ignored.
Spatialzier
The last thing that needs to be done is to create a new Soundbank that will contain the metadata relevant to the Play_c_player_foley_leather, Play_c_player_fts_L and Play_c_player_fts_R Events.
Once done, save your FMOD project and build all Soundbanks by pressing F7. If you now switch to the ACE, you'll find the new Events and the Animation Soundbank listed in the Middleware Data panel. Recall that in order to use Events and their Soundbanks within your CRYENGINE project, Events need to be connected to Triggers and Soundbanks to Preload Requests.
As always, remember to save and refresh the ACE before proceeding.
Three Events, for foley, left and right footsteps respectively, need to be created for our first person character.
Since we need only a generic 2D Container for foley, the c_player_foley_leather_long Random Container can use the same simple setup as the l_cg_amb_one_shot_tree_movement Container created in the previous chapter.
We'd like to hear the footsteps on both the right and left positions of the stereo however, which is why we'd like to set the c_player_fts_wood_L Container to 3D playback. Normally the sounds in a 3D Container would be positioned by the game engine; but since we'd like them to play at a specific position on the left/right foot, we'll position the sounds ourselves.
We do this by first selecting the c_player_fts_wood Random Container, and then the Positioning tab in the Property Editor on the right.
Left footstep
Press the spacebar at any time to preview the outcome of your positioning. When satisfied, go ahead and rename the Random Container to c_player_fts_wood_L since it now corresponds to the sound of the left footstep. To create a similar Random Container for the right footstep, create a copy of the c_player_fts_wood_L Container in the Animation Actor-Mixer, then simply rename the copy to c_player_fts_wood_R and set its playback position to the right.
To make Events of the three Random Containers we've created in this section:
Finally, create a new Soundbank called Animation and add the Animation Events folder to it as we did in Chapter 01.
Once done, save your Wwise project and generate Soundbanks by pressing the Generate All button. If you now switch to the ACE, you'll find the new Events and the Animation Soundbank listed in the Middleware Data panel. Recall that in order to use Events and their Soundbanks within your CRYENGINE project, Events need to be connected to Triggers and Soundbanks to Preload Requests.
As always, remember to save and refresh the ACE before proceeding.
Save and reload the audio engine before proceeding.
If using the SDL Mixer implementation, it is not possible to position the footstep audio assets via the middleware. Rather these assets, being stereo files, will have to be positioned before being imported into the Engine.
The Triggers that were created for footsteps and foley have to now be associated with our character's movements.
For this, we use the Character Tool, which allows users to define and set up characters by importing assets authored in third party tools. A fully authored character usually consists of a 3D model, a skeleton, physical properties and an associated animation set.
Go ahead and open the Character Tool by clicking on the Tools → Animation → Character Tool option from the Sandbox's Main Menu.
For more information on the Character Tool, please refer to its user documentation.
On the left of the tool window is the Assets panel which provides an overview of all character-related assets. Navigate to the skeleton of the player character located under Skeletons/Objects/Characters/SampleCharacter/skelProxy.chrparams.
Skeletons
The first step is to create and associate an .animevents file to the skeleton of the character, which will contain information regarding the different triggers an animation must execute while running. These triggers can be audio Triggers, Switches, or even particle effects.
Create new Animation Events file
Click on the Create a new Animevents File... button under the Character Tool's Properties panel on the right, and create a new .animevents file under ../Objects/Characters/SampleCharacter/.
Let's name it player.
Once created, open the player character's Character Definition File (.cdf) from the Assets panel under Characters/Objects/Characters/SampleCharacter/firstperson.cdf.
Double-click the CDF to choose it as the active character; this loads the character model in the middle of the tool window, and its properties on the right.
If you're seeing proxies/physics helpers over the character model, deactivate them by clicking the little mannequin and cross at the top of the screen.
You can now open the animations for the first-person character, which are stored under the Animations panel situated on the left of the Character Tool.
The left panel of the Character Tool can be split, so that the bottom half is filtered to only show animations for the active Character Definition File.
To do so, click the icon above the left panel to split it, then click the All Types dropdown to select which type files you'd like to see.
Since we're looking to add triggers to the player's footsteps, it's the walk-cycle animation of the character we're interested in, stored as 2DONE-BSpace_MoveStrafeRIFLE in the bspace folder. Click it to play the animation.
If the walk-cycle animation fails to play on click, deactivate the Bind Pose toggle in the Scene Parameters column on the upper-right of the character tool.
Bind Pose
As the animation plays, the timeline at the bottom of the Character Tool displays its progress in seconds, frames or normalized units where the length of the animation is scaled to 1.0.
You now need to create Animation Events for the character's left footstep, right footstep and foley each, associating the Play_c_player_fts_wood_L, Play_c_fts_wood_R and the Play_c_player_foley_leather audio triggers to them respectively.
Since Animation Events use normalized units for timestamps, it is recommended to set the animation timeline's units to 'normalized'.
For animations that play in third person, it makes more sense to attach triggers to specific bones of a character. To associate a trigger to a joint at a specific Animation Event, click the icon next to an Animation Event's listing.
This brings up a list of all joints used by the character. Select the most appropriate one by double clicking it.
Character Tool Best Practices
You're now ready to test the character's footsteps. Make sure to save all changes made in the character tool by selecting the File → Save All option from the menu, before jumping into game mode (Ctrl + G) in the Viewport. If timed correctly, the left/right footstep audio triggers should play with every step of the player character, interjected by the sound of foley.
You might feel that the footsteps are quite repetitive, especially since only three assets have been used for both feet. Variations can be added by adding pitch randomization to the sounds on FMOD or Wwise.
FMOD
Wwise
Randomizer
This concludes Chapter 02 of our level's audio design.
You may have noticed a campfire in the center of your Chinese garden level. The next chapter will have us adding audio effects to this campfire, before we finally move towards developing a dynamic ambience for the entire scene in Chapter 04.