Tutorial: Adding Sounds for a One-Shot Weapon This tutorial will expand on the previous tutorial to show how to setup audio for the cannon and will tie together methods of implementing sounds into Lumberyard learned in previous tutorials. By the end of this tutorial, you will have sounds playing for shooting the cannon. You will learn how to do the following: 1. Use Flowgraph to Play and Stop a Charge-Up sound while using RTPC data to control Pitch 2. Use Flowgraph to Play a Shooting sound (one-shot)
Step 1: Add a ChargeUp and Shot In this section of the tutorial, you will make a new folder and add sound objects created in Wwise LTX for the cannon and use Flowgraph to control when a sound is played and stopped. Step-by-step guide Disclaimer: Steps 1 through 3 are already pre-configured in the Wwise project. The step-bystep instructions are provided here for your reference. 1. Create a new Blend Container in Wwise under Actor-Mixer Hierarchy\Default Work Unit\SamplesProject\ named CannonChargeUp. a. For the first sound, use Wwise Tone Generator source with a Sawtooth waveform.
b. For the second sound, use Wwise Tone Generator source with a Square waveform.
2. In the Game Syncs tab, add a new Game Parameter to Game Parameters\Default Work Unit\SamplesProject\ and name it CannonChargeUpLevel. Set the Max to 6000. 3. Create an RTPC curve for the Sawtooth and Square sounds:
a. Set Voice Pitch on the Y-axis and CannonChargeUpLevel RTPC on the X-axis.
4. Open the Audio Controls Editor.
5. Create a new sub-folder for cannon ATL controls named cannon. 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 cannon by right-clicking on it and selecting Rename. 6. Drag the following Wwise controls onto the cannon folder: a. Play_cannon_charge_up b. Play_cannon_shot c. CannonChargeUpLevel 7. Select File → Save All before moving on to the next step. 8. Go back to Lumberyard and open the Flowgraph editor. In the Graphs pane, select Level\Entities\GettingStarted\FlowgraphEntity1. (Note: You may need to enable the Flowgraph layer for edit in the Layers tab of the RollupBar)
a. Create a new Audio:Trigger node and place it inside the “Audio” section. b. In the “Spawn Ball” section, connect the Pressed output of the Debug:InputKey node to the Play input of the new Audio:Trigger node. c. In the Audio:Trigger properties, click the PlayTrigger field. You will see a browse icon appear. Click the icon and you will see a browser allowing you to select an ATL Trigger. Locate the Play_cannon_charge_up control and click OK (or double-click the control).
d. Connect the Released output of the Debug:InputKey node to the Stop input of the Audio:Trigger node.
9. Let's send game data to the CannonChargeUpLevel RTPC that we created.
a. Create a new Audio:Rtpc node, place it in the “Audio” section. b. Connect the Value output of the Interpolate:Int node to the Value input of the Audio:Rtpc node. c. Similar to assigning an ATL Trigger explained above, browse and assign the RTPC ATL control CannonChargeUpLevel to the Name property of the Audio:Rtpc node.
10. Let's use the same key release to trigger a one-shot sound for the shot of the cannon. a. Create another Audio:Trigger node, place it in the “Audio” section. b. Connect the Relased output of the Debug:InputKey node to the Play input of the new Audio:Trigger node.
c. Assign the Play_cannon_shot ATL Trigger to the PlayTrigger property.
11. Now we need to assign an Entity to these three Audio nodes. a. In the Viewport, navigate to where the cannon block is, click on it to select it. b. With the object still selected, go back to Flowgraph. Right-click the Choose Entity input on one of the audio nodes and select Assign Selected Entity. c. Repeat this for the other two audio nodes. 12. Type Ctrl+G to test the cannon sounds. a. Navigate the robot to the cannon. When the camera view changes, press and hold the "I" key on your keyboard. You should hear the sound of the cannon charging up. b. Release the key and you should hear the sound of the cannon firing. c. To move the cannon left and right, press the “J” and “L” keys, respectively.
Related tasks and tutorials From this point forward, you can continue the Audio Wwise LTX tutorial series and continue to learn how to add collision sounds. Continue on to the next tutorial: Adding collision sounds 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.