This tutorial will guide you through the initial steps in getting your audio from Fmod Studio to work with CRYENGINE using the Audio Translation Layer (ATL) System.
- Setting up Fmod Studio in CRYENGINE
- Creating an Audio Setup for CRYENGINE in Fmod Studio
- Connecting Fmod Studio Controls to the Audio Translation Layer (ATL)
- Placing an ATL Trigger in the Game
Initial steps with Fmod Studio in CRYENGINE
Setting up Fmod Studio in CRYENGINE
Enable the Fmod middleware in CRYENGINE's Console by setting the s_AudioImplName CVar to CryAudioImplFmod. As an alternative add following line to your system.cfg or user.cfg file (located in the root folder of the CRYENGINE):
s_AudioImplName = CryAudioImplFmod
Fmod Studio Project and Soundbank Locations
When using Fmod Studio with CRYENGINE, you can locate the Fmod Studio specific data in the following locations:
- Fmod Studio Project:
You can select a different path for your Fmod Studio project by clicking the gear icon in the top-right corner of the Audio Controls Editor.
By default, CRYENGINE checks these folders to locate all the Fmod Studio Controls and Soundbanks and displays those files in the Audio Controls Editor.
Verifying the Supported Fmod Studio Version
Before you set up your Fmod Studio Project, make sure that you are using the correct version of Fmod Studio with CRYENGINE. The CRYENGINE is always updated to support the latest version of Fmod Studio.
To make sure that you are using the correct version, open the Console in CRYENGINE, and then type s_DrawAudioDebug a. Now, you can see (in the top left hand corner) the current version of Fmod Studio that is supported by the Audio Translation Layer in your CRYENGINE build.
You can download the latest Fmod Studio version from here.
Creating an Audio Setup for CRYENGINE in Fmod Studio
Creating a Sound Event in Fmod Studio
In Fmod Studio, you can import audio into the Event Editor by dragging and dropping the file or by using the Import option (File->Import Audio Files).
After you import an audio file in *.wav format, Fmod Studio will create a new sound event for it.
For each sound event in Fmod Studio, you can adjust multiple settings in the Deck area below the Timeline section. In the Deck area, you can change settings including the Volume, Pitch, Low/High-Pass Filtering and Positioning of the sound.
Creating a Soundbank in Fmod Studio
To integrate a new event into your game, you need to create a Soundbank in Fmod Studio that can be loaded by CRYENGINE.
In Fmod Studio, select the Bank tab in the Event Editor, and then right-click to create a new bank.
Now you can populate the Soundbank with the audio content that you have created. In the Event tab, right-click on the sound event (selecting multiple events is possible) and choose Assign to Bank (see below). You can also assign the sound events directly to a new bank.
Make sure that the Soundbanks are located in the below mentioned location in order to be detected by the Audio Controls Editor:
If you want to use streaming, go to Preferences -> Build and select Build metadata, non-streaming assets, and streaming assets to separate banks:
This will build the following banks:
- <bankname>.bank (contains meta data)
- <bankname>.assets.bank (contains non-streamed assets)
- <bankname>.streams.bank (contains streamed assets)
The .bank file needs to be preloaded via an ACE preload request in order for the streamed assets to beplayed,
Automatically Generating Soundbanks
You can set up Fmod Studio to automatically generate the Soundbanks in the correct location by adjusting the bank directories in Edit -> Preferences -> Build.
Now that you have created the setup in Fmod Studio, the Audio Controls Editor will be able to recognize the Fmod Studio Controls and Soundbanks. You can open CRYENGINE and select the Audio Controls Editor under the Tools menu.
Connecting Fmod Studio Controls to the Audio Translation Layer (ATL)
Now the Audio Controls Editor lists all the Fmod Studio Controls contained in your Fmod Studio Project and your generated Soundbanks.
You can now connect them to the Audio Translation Layer in order to integrate them into your level in CRYENGINE. You need to create a new folder in the Audio Controls Editor by selecting the +Add button and select Folder from the drop-down list.
After the folder has been created, you can simply drag and drop the Fmod Studio Controls into the new folder on the ATL Controls side. CRYENGINE will automatically create the corresponding connected ATL Controls and name them after their Fmod Studio counterparts.
You will see that two types of ATL Controls have been created, an ATL Trigger and ATL Preload. The ATL Trigger will be used to call the Fmod Studio Event in your game while the ATL Preload will be used to load the Fmod Studio Soundbanks so that all data related to the event is included in memory.
On the ATL preload, make sure that the Auto-Load checkbox is activated and leave the Scope on Global for now. You can read more about using scopes in the Audio Controls Editor here.
Placing an ATL Trigger in the Game
If you have followed the above steps, you can now select your ATL trigger in the editor and play it back on an Audio Entity. You can pre-listen your ATL Triggers in the Audio Controls Editor by right-clicking on it and selecting Execute Trigger.
In order to listen to your sound in the game, you need to place an audio entity in the Level which executes the audio trigger during the game play.
For each level, it is recommended to first create a dedicated audio layer which contains your audio data. To enable this, select Tools-> Level Editor-> Level Explorer, and then select File-> New Layer to create a new layer and rename it as Audio.
As long as the Audio Layer is selected all entities that you place in the level will be included in this layer. Now go back to the Create Object, and select the Audio Trigger Spot entity in the Audio tab and place the entity in the level.
If you have followed the above steps correctly, you can now select your created ATL trigger in the Properties tab of the Audio Trigger Spot. It will be played back as soon as the Audio Trigger Spot Entity is enabled.
For more information, take a look at the functionality of the Audio Trigger Spot in combination with Fmod Studio here.