Tutorial: Adding Sounds to a Character This tutorial will introduce you to some of the techniques used to add audio to the Robot character and will teach you some more advanced ways of implementing sounds into Lumberyard using Flowgraph. By the end of this tutorial, you will have sounds playing for the Robot character. You will learn how to do the following: 1. Trigger a one-shot head movement sound for the character using Flowgraph. 2. Trigger a character movement loop using Flowgraph. 3. Use Flowgraph to control RTPC values in sounds to change pitch and volume.
Step 1: Adding Sounds to Robot Head Tilt In this step, you will learn how to trigger a sound event using Flowgraph scripting. Step-by-step guide Disclaimer: Steps 1 through 4 are already pre-configured in the Wwise LTX project. The stepby-step instructions are provided here for your reference. 1. Add Sounds for Robot Head movement and Motor and Wheel movement to Actor-Mixer Hierarchy (sounds are located in \dev\SamplesProject\Sounds\wwise_project\Originals\SFX\):
2. Create Play and Stop Events for RobotMovement called Play_robot_movement and Stop_robot_movement. Create a Play Event for RobotHeadMove called Play_robot_head_move. Nest the new Events under the SamplesProject folder of the
Events tab as shown here:
3. In the Game Syncs tab, add a new Game Parameter to Game Parameters/Default Work Unit/SamplesProject and name it RobotHead. 4. Assign the RobotHead RTPC to the RobotHeadMove sound, with the Y-axis assigned to Voice Pitch:
5. Open the Audio Controls Editor.
6. Create a new sub-folder for Robot ATL controls named robot. a. Select the tutorial_controls folder, then click on the +Add dropdown and select Folder to create a new empty sub-folder.
b. Rename the newly created folder to robot by right-clicking on it and selecting Rename. 7. Drag the following Wwise Controls onto the robot folder: Play_robot_head_move Play_robot_movement RobotHead RobotVelocity Stop_robot_movement 8. Select File → Save All before moving on to the next step.
9. Open the Flowgraph Editor, and open the Flowgraph under Global\Modules\Character_Controller_Robot:
10. Connect Robot Head movement to an Audio:Trigger node. a. The first step is to connect the Robot_Head output of the controller to a Logic:Any node. (This connection is pre-made)
We will use the Logic:Any node to simplify routing the signal from the Character_Controller module. b. Connect the Logic:Any Out output to the Choose Entity input on two Audio:Rtpc nodes and an Audio:Trigger node. Every time the head moves, it sets the RTPC to a specific value and plays the sound (attached to the Robot_Head).
c. Route signal from Strafe Left and Strafe Right into a Logic:Any node. Route signal from Strafe Stop into another Logic:Any node. (These connections are pre-made)
d. Input ports can only accept one input, so we'll use the Logic:Any node to enable multiple inputs to be routed into a single output. e. Connect the Out output of the “Head Reset” Logic:Any node to the Activate input of the Math:SetNumber node with a 0 value. f. Connect the Out output of the “Head Tilt” Logic:Any node to the Activate input of the Math:SetNumber node with a 1 value. g. Connect the Out outputs of the two Math:SetNumber nodes to the In# inputs of the next Logic:Any node. Connect the Out output of this Logic:Any node to the Play input of the Audio:Trigger node. h. Connect each Out output from the Math:SetNumber nodes to the Value inputs of each Audio:Rtpc node.
i.
The final connections should look like this:
11. When an input is received by the “Head Tilt” Logic:Any node, it activates a Math:SetNumber node.
12. This number is routed to an Audio:Rtpc node to set the RobotHead RTPC value to 1, and this is sent further to activate the Play input of the Audio:Trigger node to play the Play_robot_head_move ATL Trigger.
13. When an input is received by the “Head Reset” Logic:Any node, it activates another Math:SetNumber node.
14. This number is routed to another Audio:Rtpc node to set the RobotHead RTPC value to 0, and this is also sent further to activate the Play input of the Audio:Trigger node to play the Play_robot_head_move ATL Trigger.
15. This is just one method of using Flowgraph to control audio and as you explore Flowgraph further, you will discover more ways to integrate audio into Flowgraph logic.
Step 2: Adding Sounds to Robot Movement In this step, you will learn additional techniques for using Flowgraph to control your sounds. You will learn how to use Flowgraph data to control an RTPC defined on a sound object in Wwise LTX. Step-by-step guide Disclaimer: Steps 1 through 2 are already pre-configured in the Wwise LTX project. The stepby-step instructions are provided here for your reference. 1. Create a Blend Container for RobotMovement in Wwise. a. Inside this Blend Container, combine the following two loops: RobotWheelRollLp RobotElectronicMotorLp 2. Create an RTPC for RobotVelocity and assign it to RobotElectronicMotorLp to control Voice Pitch and Voice Volume.
3. Now, let's update the Flowgraph to trigger sounds based on the movement of the Robot. a. First, send the output of Awesome_Sphere to the input of a Logic:Any node. (This connection is pre-made)
b. Then, connect the Out output of the Logic:Any node to the Choose Entity input on the Audio:Rtpc and Audio:Trigger nodes for “Robot Movement Sound”. c. Connect the Out output of the “Robot Velocity” Logic:Any node to the Activate and A inputs of the Math:Div node.
d. Connect the Out output of the Math:Div node to the Value input of the Audio:Rtpc node. e. Connect the Out output of the “Sphere Movement” Logic:Any node to the Play input of the Audio:Trigger node. f. The connections should now look like this:
4. The Velocity Output from the Vec3:NormalizeVec3 node in the "Updates Chase Cam POS and fov based on velocity" section, is the raw robot velocity. We route the output of that to a Math:Div node to normalize the value to roughly [0, 1].
5. Then we take the normalized velocity output to the value input of an Audio:Rtpc node driving the RobotVelocity RTPC.
6. At the same time, we activate an Audio:Trigger node to play the Play_robot_movement ATL Trigger. In Wwise we authored the RobotVelocity RTPC to drive pitch and volume for this sound.
7. Type Ctrl+G to test the robot movement sound. a. You should hear the sound of the robot as you move the character forward. b. As the robot turns direction, you should hear the sound of the robot tilt its head.
Related tasks and tutorials From this point forward, you can continue the Audio Wwise LTX tutorial series and continue to learn how to add sounds to a weapon. Continue on to the next tutorial: Adding sounds to a one-shot weapon We’d love to hear from you! Head to our Tutorial Discussion forum to share any feedback you have, including what you do or don’t like about our tutorials or new content you’d like to see in the near future.