FMOD Studio User Manual 2.02

13. Dialogue and Localization

In many game projects, dialogue has a number of features that make it different to other kinds of game audio. Most games with dialogue include a large number of individual lines, and need control over which specific lines are played; dialogue is almost always language-specific, and so the audio asset to be played in any given situation depends on the language to which the game is set; and occasionally some lines of dialogue may not be recorded and available to be added to an FMOD Studio project until relatively late during a game's development.

While it is possible to create a unique FMOD Studio event for each and every line of dialogue in each of the languages your game supports, it is faster and easier to create one dialogue event containing a programmer instrument. Then, every time a line of dialogue is spoken in your game, your game can create a new instance of this dialogue event, and your game's code can select the specific line of dialogue which the instance is to play.

Audio tables allow you to build audio files into banks without having to add them to instruments. This allows audio files used by programmer instruments to be included in banks, granting them the benefit of bank compression and loading. In addition, localized audio tables make it easier to organize audio files of different languages so that they can be swapped in and out depending on your players' language settings.

13.1 Audio Tables

Audio tables are lists of audio files stored outside your FMOD Studio project's asset folder. They're assigned to the bank associated with the audio table and, at the time of building, are compressed and bundled together with the other assets assigned to that bank. The files can then be played by programmer instruments in your project when your game is being played.

To create an audio table, right click on a bank in the banks browser and select "Add Audio Table". Each bank can have only one audio table.

An audio table automatically includes the audio files in its source directory. You can set an audio table's source directory by typing a path into its "Source directory" field, or by clicking the "Browse..." button and selecting an appropriate directory from the file dialog. The path in the source directory field can include environment variables, for example %HOME% or $HOME. If the path is relative, e.g. ../source, it is treated as relative to the FMOD Studio project folder.

FMOD Studio searches recursively through every subfolder from the source directory for all audio files if the "Include sub directories" checkbox is checked. If this checkbox is not checked, FMOD Studio searches the directory itself, but none of its subfolders.

Programmer instruments allow you to play these audio files in events. When triggered, programmer instruments generate callbacks within the FMOD Studio API, allowing your game to choose which audio file the instrument should play. For more information on callbacks and how to use them, please see the Dialogue and Localization section of the FMOD Engine User Manual, the Programmer Sounds section of our Unreal Integration documentation, or the Programmer Sounds Scripting Example subchapter of our Unity Integration documentation.

Audio tables can scale to handle thousands of audio files. Using audio tables can therefore reduce the complexity of your project by allowing one event with a programmer instrument to play many different lines of dialogue in your game.

When auditioning in FMOD Studio, a programmer instrument cannot play the file it will reference when triggered in your game. However, you can drag an audio file or audio table onto the "Placeholder" section of a programmer instrument displayed in the deck in order to make that file or audio table play when the instrument is auditioned in FMOD Studio. Making an audio file a placeholder does not automatically assign that audio file to a bank.

Adding an audio table to a master bank is not recommended. This is because a master bank must be loaded at all times, meaning that it is not possible to unload the master bank in order to conserve memory consumed by its audio table. However, in small projects where only one bank is needed and the assets require very little memory, adding an audio table to the master bank may be viable.

13.1.1 Localized Audio Tables

Localized audio tables are a special kind of audio table with features that facilitate localization. We recommend using localized audio tables if your game supports multiple spoken languages, or if you intend to add support for additional languages in a future patch.

Unlike other audio tables, localized audio tables automatically append the locale code to the end of their source directory paths. This means that a localized audio table actually has multiple different source directories, one for each of your project's locales.

When you build a bank which contains a localized audio table, FMOD Studio automatically produces one version of the built bank for each locale. Each of these banks contains the audio files for the locale it represents, and has the code for that locale as an underscore-separated suffix to its file name.

For example, if your game has two locales with the locale codes "PRC" and "FRE", and your game's "Dialogue" bank features a localized audio table with the source directory C:/Audio, the localized audio table's source directories will be /Audio/PRC and /Audio/FRE. When you build your project, FMOD Studio produces two files, Dialogue_PRC.bank and Dialogue_FRE.bank.

You can define new locales and locale codes in the assets tab of the preferences dialog.

To create a localized audio table, right click on a bank in the banks browser and select "Add Localized Audio Table". To make an existing non-localized audio table localized, right-click on it and select "Localized". Localized audio tables are marked with a "Localized" tag in the banks browser.

Adding a localized audio table to a master bank is not recommended. This is because a localized audio table causes multiple locale-specific versions of its associated bank to be built, resulting in efficient redundancy of the master bank's data. In addition, because a master bank must be loaded at all times for your game's audio to function, it is not possible to unload a locale-specific master bank in order to load the master bank for a different locale without stopping all audio in your game.

13.1.2 Keys

A key is a variable name given to an audio file that is included in an audio table. It can be used in place of the audio file's name and path when creating a sound from that audio file. If you create multiple different banks with keys or use a localized audio table to create multiple versions of a bank from multiple different source directories, you can assign the same key to a different audio file in each bank. This allows you to use one key to create sounds based on various different audio files, such that the name of the audio file used depends on which bank is loaded when you use the key.

Keys are mostly used for localizing dialogue. If you create a version of a bank for each spoken language your game supports, you can use the key associated with a line of dialogue to play that line of dialogue in the language of the currently loaded bank, even if the name of the audio file for that line of dialogue differs depending on which bank is loaded.

By default, the key for an audio file is the filename of that audio file, minus the filename extension. If you wish to use different keys for the audio files in a bank, place a text file named keys.txt in the bank's audio table source directory; or, if using a localized audio table, place a text file named keys.txt in each of the audio table's source directories. Fill these files with a list of the keys you want to use, along with the names of the audio files to which they correspond, as in the following example:

Greetings,hello01.wav
Farewell,goodbye01.wav

In this example, the keys are "Greetings" and "Farewell", and they correspond to hello01.wav and goodbye01.wav, respectively.

Audio files not listed in a source directory's keys.txt file are not included in the built bank.