Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Overview
This chapter of the Audio Showcase tutorial serves as an introduction to the Audio Controls Editor (ACE) tool, audio triggers, and so demonstrates the basic workflow of implementing sounds within a level.
Files
Click the file below for a downloadable PDF copy of this chapter.
View file | ||||
---|---|---|---|---|
|
FMOD Video Tutorial
The FMOD workflow of this chapter is also covered in the following video:
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Project Setup
Begin by creating a new CRYENGINE project from the Launcher by selecting the +New icon shown in the image below.
First Person Shooter
This opens the My Engines library which lists all installed CRYENGINE versions; click the +Create Project button under CRYENGINE 5.6.4 (assuming 5.6.4 has already been downloaded and installed).
Since the Audio Showcase tutorial is implemented using the First Person Shooter C++ template, select the CPP First Person Shooter template from the Project Browser, give the project a name, and click Create Project to complete the process.
Project Browser
Next, navigate to the Showcase_Level.zip package and copy its contents to the folder of the project you just created. Be sure to select the Replace the files in the destination option in the dialog prompt that appears.
This is to not only replace certain files in the default First Person Shooter template project, but to also make changes such as deleting the reference to .animevents from the player skeleton, and setting sound_obstruction within the SurfaceTypes.xml to 0 for the purpose of this tutorial.
Tip |
---|
To locate your project's installation directory, click the |
Note |
---|
At this point, you must decide if you'd like to follow the entire tutorial, or skip the setup and other instructions for FMOD Studio, Wwise and/or SDL Mixer.
Make sure none of the downloaded asset files are write protected. |
Middleware Setup
Middleware setup
Expand | ||||
---|---|---|---|---|
| ||||
FMOD Studio
If you choose to use FMOD Studio with this tutorial, begin by creating a folder named fmod in the /Assets/Audio directory of the project created in the previous step. Inside the fmod folder, create two new folders named ace and assets respectively. Assuming FMOD Studio has been downloaded and installed on your system, launch it, and create a new FMOD project of the name fmod_project. Save this project inside the /Assets/Audio/ directory of your CRYENGINE project.
Next, to define where FMOD saves Soundbanks so that they can be read by the Engine;
Pressing the F7 key should generate the Master Bank. The final step in the middleware setup involves configuring the ACE to use your choice of middleware implementation. To have the Engine's audio system load the FMOD implementation;
|
Expand | ||||
---|---|---|---|---|
| ||||
Wwise
If using Wwise with this tutorial, create a folder named wwise in the /Assets/Audio directory of the project created in the previous step. Inside the wwise folder, create two new folders named ace and assets respectively.
After the installation ends, launch Wwise and click New on the Project Launcher window to create a new project. Name the project wwise_project and save it in the /Assets/Audio/ directory of your CRYNENGINE project as shown below.
Next, to define where Wwise generates SoundBanks so that they can be read by the Engine;
If you now open the Assets/Audio/wwise/assets folder in your project directory, you'll find that files such as Init.bnk and Init.txt have already been created by Wwise. To have the Engine's audio system load the Wwise implementation;
|
Expand | ||
---|---|---|
| ||
SDL MixerThe Assets/Audio directory of your project contains a folder called SDLMixer, which contains two folders named of ace and assets. If using an SDL Mixer audio middleware implementation, the files created during the course of this tutorial will be stored within these two folders. To have the Engine's audio system load the SDL Mixer implementation;
|
Info |
---|
The s_ImplName CVar defines which audio middleware implementation (SDL Mixer, FMOD Studio or Wwise) is loaded by CRYENGINE's audio system. It's recommended to set its value via the user.cfg file of your project. |
Level Load and Orientation
With your middleware setup, open the Audio Showcase level by selecting File → Open → Levels → Showcase_Audio from the Engine's main menu, or by opening the Game.cryproject file that was copied into your project directory.
Once the level has been loaded, navigate through it in first-person by switching to game mode (Ctrl + G). Move the first-person character using the WASD keys, aim and shoot using the mouse buttons.
Viewport
You'll find that the garden consists of a large pond within a walled area, plenty of vegetation and a campfire at its center. Also included are two pagodas connected by walkways, a marketplace situated behind a closed gate, and a forest surrounding the entire enclosure.
Audio Controls Editor (ACE)
It's now time to familiarize yourself with the ACE, which acts as a connection between CRYENGINE and your audio middleware of choice.
Accessed from the Tools → Audio Controls Editor option of the Engine's main menu, the ACE consists of four panels namely, Audio System Controls, Properties, Middleware Data and Contexts; note that only the first three are relevant to this tutorial.
Audio Controls Editor
The Audio System Controls panel lists all controls (Triggers, Parameters, Switches, Environments and Preloads) included within the current CRYENGINE project, which allows users to create controls as needed.
The Middleware Data panel lists the available audio middleware controls that can be connected to a selected Audio System Control, while the Properties panel is where connections between a middleware and the Audio System Controls can be made.
Info |
---|
Audio System Controls must be stored in an ACE Library; these Libraries are saved in the .../Assets/Audio/fmod/ace directory of the project if using FMOD, .../Assets/Audio/wwise/ace directory if using Wwise, or .../Assets/Audio/sdlmixer/ace when using SDL Mixer. An Audio System Control can be created by;
For an in-depth overview of the ACE tool window, its panels and menu options please refer to its user documentation. |
The properties of these controls can also be edited via the Properties panel.
Adding Sound to Gunfire
You would have noticed that in game mode, clicking the LMB causes the first person character to shoot a weapon. The goal of this section is to add sound to gunfire that is triggered every time the player character fires the weapon.
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
FMOD StudioIf using FMOD Studio, the audio effect for gunfire has been included in the _Audio_Assets/FMod Studio/chapter_01/ folder of the Audio Showcase assets' installation directory as Play_w_gun_fire_01.wav. Creating an Event and Soundbank on FMOD StudioDrag and drop this .wav file from disk to the Events tab on the left of your FMOD project; this opens the Create Event window with the option to create a 2D Event or a 3D Event. Select 2D Event and click the Create button to complete the process.
After the Event, a Soundbank needs to be created. Soundbanks store metadata related to audio assets, and also contain compressed/encrypted audio material. To create a Soundbank for the imported gunfire audio asset;
Creating an Audio TriggerFor the Play_w_gun_fire_01 event to be triggered in the Showcase_Audio level, it needs to be connected to an audio Trigger in the ACE. If you haven't already, open the ACE in CRYENGINE by using the Tools → Audio Controls Editor option from its Main Menu. You should now be able to see the folder structure of your FMOD project in the Middleware Data panel, with the Play_w_gun_fire_01 event listed under the Events folder, and the Weapon Soundbank under the Soundbanks folder. To create a Trigger;
The created Trigger will be listed with the
Save both the Weapon and the Preloads Libraries by clicking the
|
Expand | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
WwiseIf using Wwise, the audio effect for gunfire has been included in the _Audio_Assets/Wwise/chapter_01/ folder of the Audio Showcase level assets' installation directory as w_gun_fire_01.wav. Creating an Event and Soundbank on WwisePress the F5 key in Wwise to switch back to its Designer Layout. On the left of your project window is the Project Explorer, it consists of several hierarchies; while the Interactive Music Hierarchy is reserved only for music, sound effects can be imported into the Actor-Mixer Hierarchy. To import our gunfire audio effect;
To now actually create an Event for the w_gun_fire_01 object, right-click the w_gun_fire_01 Sound SFX container and select the New Event → Play option from the menu. If you switch to the Events tab in the Project Explorer, then you should be able to see the created Event Play_w_gun_fire_01.
Since SoundBanks store metadata and other information related to an audio asset, then we need to create a SoundBank for the created Event so that it can be used in our level.
Save your Wwise project. We now need to add the Play_w_gun_fire_01 Event to the Weapon SoundBank, so that Wwise recognizes in which SoundBank the Event's data needs to be stored. To do so;
In this way, we've defined that all the content of the Weapon Events folder should be built into the Weapon SoundBank. Save the Wwise project again, and click the Generate All button at the top of the window.
Creating an Audio TriggerFor the Play_w_gun_fire_01 event to be triggered in the Showcase_Audio level, it needs to be connected to an audio Trigger in the ACE. If you haven't already, open the ACE in CRYENGINE by using the Tools → Audio Controls Editor option from its Main Menu. You should now be able to see the folder structure of your Wwise project in the Middleware Data panel, with the Play_w_gun_fire_01 event listed under the Events folder, and the Weapon Soundbank under the Soundbanks folder. To create a Trigger;
The created Trigger will be listed with the
Save both the Weapon and Preloads Libraries by clicking the
|
Expand | ||||
---|---|---|---|---|
| ||||
SDL MixerIf using SDL Mixer, the audio effect for gunfire has been included in the _Audio_Assets/sdlmixer/chapter_01/ folder of the Audio Showcase level assets' installation directory as Play_w_gun_fire_01.ogg.
For Play_w_gun_fire_01.ogg to be triggered in the Audio Showcase level it needs to be connected to an audio Trigger in the ACE. If you haven't already, open the ACE in CRYENGINE by using the Tools → Audio Controls Editor option from its Main Menu. You should now be able to see the Weapon folder in the Middleware Data panel, with the Play_w_gun_fire_01.ogg included. To create a Trigger;
The created Trigger will be listed with the
When the Play_w_gun_fire_01 Event is selected in the Audio Systems Control panel, its properties are listed in the center Properties panel; deactivate the Enable Panning and Enable Attenuation toggles, and save the created Library.
|
Jump into Game Mode (Ctrl + G) and press the LMB to fire the weapon; on gunfire, the created Audio Trigger is called by CRYENGINE's visual scripting tool Flow Graph causing the Play_w_gun_fire_01 Trigger to play.
Tip | ||
---|---|---|
| ||
The gunfire volume is too low? Select the Play_w_gun_fire_01 Trigger in the ACE and increase the value of the Volume (dB) field in the Properties panel to -6. |
Adding Tree Movements
Expand | ||||
---|---|---|---|---|
| ||||
FMOD StudioIf you go back to the chapter_01 folder that contained the Play_w_gun_fire_01.wav file in the previous step, you'll find four distinct audio tracks named l_cg_amb_one_shot_tree_movement_0X.wav. These sounds are meant to mimic the natural rustle of leaves and serve as the basis of the level's ambience. In this step, we'll combine all four audio assets to form a 3D Event in FMOD which will then be connected to an Audio Trigger Spot Entity so that it can be heard within the level. Creating a 3D Event in FMOD StudioOpen the Audio Bin in FMOD Studio by selecting the Window → Audio Bin option from its main menu, or by using the Ctrl + 3 keyboard shortcut; the Audio Bin is where the project's audio assets are stored. To keep the Audio Bin organized, we create a folder named Ambience and within it, another folder called oneshots. Drag and drop the four audio asset files Play_l_cg_amb_one_shot_tree_movement_0X.wav into the oneshots folder.
Switch back to the Events tab in FMOD Studio's main window. We need to create a folder by right-clicking within the tab and selecting the New Folder option. We will name the folder oneshots within a folder named Ambience (as we did in the Audio Bin). Next, drag and drop the four audio asset files l_cg_amb_one_shot_tree_movement_0X .ogg from the Audio Bin into the oneshot folder of the Event tab; as before this opens the Create Event window with the option to create a 2D Event or 3D Event. Since we need to create a 3D Event;
Rename the Event to Play_l_cg_amb_one_shot_tree_movement by double-clicking it.
As with the Play_w_gun_fire_01 Event created in the previous step, a Soundbank is needed to be able to use and hear the Play_l_cg_amb_one_shot_tree Event in our project. To do so;
If you switch to the Audio Controls Editor, you'll now find the Play_l_cg_amb_one_shot_tree Event listed under Events → Ambience → oneshot of the Middleware Data panel. This now needs to be connected to an audio Trigger in the Audio System Controls panel. To do so;
Now since the Event's Ambience Soundbank containing its audio playback information also needs to be loaded into memory for it to function, a Preload Request for the same needs to be created in the ACE.
|
Expand | ||
---|---|---|
| ||
WwiseIf you go back to the chapter_01 folder that contained the w_gun_fire_01 file in the previous step, you'll find four distinct audio tracks named l_cg_amb_one_shot_tree_movement_0X.wav. These sounds are meant to mimic the natural rustle of leaves, and serve as the basis of the level's ambience. In this step we'll combine all four audio assets to form an Event on Wwise, which will then be connected to an Audio Trigger Spot Entity so that it can be heard within the level. Creating an Event and SoundBank in WwiseOpen Wwise and create a new Actor-Mixer within the Default Work Unit of the Actor-Mixer-Hierarchy. Name it Ambience. We then need to create a Random Container, whose function will be to play the l_cg_amb_one_shot_tree_movement_0X audio files randomly;
You could preview the randomization of these tracks by selecting the Random Container and pressing the spacebar. The Random Container can operate in different modes and which can be changed via the Play Type section of the Random Container Property Editor on the right panel.
The next step is to create an Event for the l_cg_amb_one_shot_tree_movement Random Container.
Since this Event also requires a SoundBank, switch to the SoundBanks tab of the Project Explorer and create a new SoundBank called Ambience. Switch your Wwise window to SoundBank Layout by pressing F7, then assign the Ambience Event folder to the Ambience SoundBank as we did in the previous section. Remember to click Generate All to regenerate all SoundBanks, and save your Wwise project when complete.
If you switch to the Audio Controls Editor, you'll now find the Play_l_cg_amb_one_shot_tree Event listed under Events → Ambience of the Middleware Data panel. This now needs to be connected to an audio Trigger in the Audio system Controls panel. To do so;
Now since the Event's Ambience Soundbank containing its audio playback information also needs to be loaded into memory for it to function, a Preload Request for the same needs to be created in the ACE.
|
Expand | ||
---|---|---|
| ||
SDL MixerIf you go back to the chapter_01 folder that contained the Play_w_gun_fire_01.ogg file in the previous step, you'll find a track called Play_l_cg_amb_one_shot_tree_movement.ogg. Its audio is meant to mimic the natural rustle of leaves, and serves as the basis of the level's ambience. In this step we'll connect the audio file to an Audio Trigger Spot Entity so that it can be heard within the level.
Save Libraries and reload the audio engine as before. |
Audio Trigger Spot
We now need the Play_l_cg_amb_one_shot_tree Trigger to play across the entire level, for which we use the Audio Trigger Spot (ATS) Entity. The ATS triggers audio Events at a specific position, which can be automatically randomized along with time delays.
It is found under the Create Object tool, accessed via the Tools → Level Editor → Create Object option of the Sandbox's main menu.
- Select the Audio → Audio Trigger Spot option from the Create Object tool panel.
- If you now mouse-over the Viewport, you should see the
icon representing the ATS Entity; click anywhere on the ground of the Audio Showcase level to place it.
- At this point, the properties of the ATS Entity should be visible in the Properties panel on the right of your Sandbox window. Locate the PlayTrigger field, click the
icon and select the Play_l_cg_amb_one_shot_tree Trigger from the list.
This field, as you've probably guessed, specifies the audio Trigger that needs to be played by the ATS Entity. - At this stage the Play_l_cg_amb_one_shot_tree sounds should be audible both in the Viewport and in Game Mode.
To have the Trigger execute more frequently, set the value of the Behavior field under the ATS Entity's Play Mode properties to TriggerRate.
ATS Placed
This causes the Trigger to execute every 'x' seconds after the previous Trigger instance, where 'x' is a random value between the ATS' MinDelay and MaxDelay property values. These fields are found directly under the ATS' Behavior property field.
Note |
---|
Although the MinDelay and MaxDelay values are defined in seconds, they're specified in milliseconds within this tutorial due to a bug in Engine release 5.6.4 that produces unexpected results. |
Try setting their values to 1000 and 100,000 respectively, so that the Play_l_cg_amb_one_shot_tree sound is re-triggered every 1-100 seconds.
Conclusion
Although the ambience trigger is called by an audio specific Entity (the ATS), triggers can also be called in the same way using animations, particle effects, or by code.
This concludes the first chapter of the Audio Showcase tutorial. The remaining chapters will have us implementing audio for player footsteps, particle effects and dynamic ambience.
On This Page
Table of Contents | ||||
---|---|---|---|---|
|