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.
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
When using Fmod Studio with CRYENGINE, you can locate the Fmod Studio specific data in the following locations:
|In release 5.5 the location for soundbanks changed to <ProjectFolder>\assets\audio\fmod\assets.|
You can select a different path for your Fmod Studio project by going to Edit -> Preferences in the Audio Controls Editor. You can then type the desired path or browse for the folder with the Browse button:
By default, CRYENGINE checks these folders to locate all the Fmod Studio Controls and Soundbanks and displays those files in the Audio Controls Editor.
When you ship your game, make sure you include only the Soundbanks in the game folder as they contain all data from the Fmod Studio Project.
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.
If you are new to Fmod Studio, we recommend you to read the Fmod Studio manual. You can also visit the Fmod support page here.
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.
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:
The .bank file needs to be preloaded via an ACE preload request in order for the streamed assets to beplayed,
|The .streams.bank is not be displayed in the ACE as it will be automatically accessed on demand.|
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.
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.
CRYENGINE requires the Fmod Studio Soundbank that contains your event data to be loaded in order to play sound in your level. Therefore, make sure to connect your Fmod Studio Soundbanks to ATL Preloads and update them while adding new content in Fmod Studio.
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.
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.
It is recommended to name your audio entities with abbreviations to improve readability in large projects. For the Audio Trigger Spot, you can use ATS abbreviation. Therefore, a frog idle sound could be called ATS_frog_idle on the Audio Trigger Spot 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.
When a StopTrigger is executed and the StopTriggerName is left empty, CRYENGINE will automatically stop the Fmod Studio event from playing. This is important to remember as the behavior is same in all places in CRYENGINE where a StopTrigger can be used.
If you want to fade out a sound, you need to create an AHDSR Modulation for the volume in Fmod Studio and add a StopTrigger in the Audio Controls Editor. The AHDSR Modulation is also used to create fade-ins.
When you select a connection in the Connected Controls window, you can choose if the sound should be started or stopped using the Action drop-down option.
For more information, take a look at the functionality of the Audio Trigger Spot in combination with Fmod Studio here.