# Problem with voiceovers in different languages

**URL:** <https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039>\
**Category:** Unreal Engine\
**Created:** [August 26, 2024, 11:35am UTC](https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039 "2024-08-26T11:35:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasha\_imagine](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@sasha\_imagine](https://qa.fmod.com/u/sasha_imagine)\
**Post date:** [August 26, 2024, 11:35am UTC](https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039/1 "2024-08-26T11:35:30Z")

</div>

Guys, maybe someone can help:  
I’m working in FMOD with UE5.4.  
In our game the main character will have a voiceover in 2 languages.  
Here while everything is clear - you make an event with 2 tracks.  
the first language, the second language. make a parameter and mute one or the other track depending on the selected language.  
The difficulty is that we have a hero’s speech is duplicated by subtitles and they must disappear at the moment when the speech ends.  
When you work with one language, the UE can take the length of the asset in seconds from the event, and so you can easily synchronize the voiceover and subtitles, but when the event is 2 different voices on different tracks, it takes the length of the longest asset in the event but not the one that is now active, so there are problems with synchronization. Is there any variants how to fix it? to make different events for different languages is not an option.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Leah\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/leah_fmod/32/3685_2.png) [@Leah\_FMOD](https://qa.fmod.com/u/Leah_FMOD)\
**Post date:** [September 4, 2024, 2:12am UTC](https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039/2 "2024-09-04T02:12:26Z")

</div>

Apologies for the delayed response.

There are potentially ways of using parameters to control localized audio like this, but as you’ve noted, subtitling can become an issue. There are potentially ways to work around this, but the intended method to handle [localized dialogue](https://www.fmod.com/docs/2.02/studio/dialogue-and-localization.html) is to assign them to an audio table, and then to use [programmer sounds](https://www.fmod.com/docs/2.02/unreal/user-guide.html#programmer-sounds) in engine to play assets from the audio table based on what language is being used.

By placing a programmer instrument in an event in Studio, you can use the [FMOD\_STUDIO\_EVENT\_CALLBACK\_TYPE](https://www.fmod.com/docs/2.02/api/studio-api-eventinstance.html#fmod_studio_event_callback_type) type `FMOD_STUDIO_EVENT_CALLBACK_CREATE_PROGRAMMER_SOUND` to receive a callback when the programmer sound is to play an asset, and use a localized audio table to select the asset to play based on the current language.

When the programmer sound asset stops playing, the callback `FMOD_STUDIO_EVENT_CALLBACK_DESTROY_PROGRAMMER_SOUND` fires, which you can use to stop displaying the current subtitle. It would also be possible to use the length of the actual asset being played to determine the amount of time to display subtitles, which can be retrieved with [Sound::getLength](https://www.fmod.com/docs/2.02/api/core-api-sound.html#sound_getlength).

This only requires the use of a single event, so it would satisfy your need to avoid using different events for different languages. I would recommend giving programmer sounds a shot, and letting me know if you run into any issues or if there’s any reasons why this method doesn’t work for you.

---

<div class="post-metadata">

**Author:** ![sasha\_imagine](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@sasha\_imagine](https://qa.fmod.com/u/sasha_imagine)\
**Post date:** [October 8, 2024, 9:13am UTC](https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039/3 "2024-10-08T09:13:04Z")

</div>

Thank you so much! We will try now

---

<div class="post-metadata">

**Author:** ![BashOrgRu](https://avatars.discourse-cdn.com/v4/letter/b/f475e1/32.png) [@BashOrgRu](https://qa.fmod.com/u/BashOrgRu)\
**Post date:** [October 8, 2024, 11:36am UTC](https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039/4 "2024-10-08T11:36:54Z")

</div>

Hello. We haven’t fully figured out yet how to properly implement localization using “event callback,” “audio table,” and “programming sounds.” We will definitely look into this. However, I wanted to ask if there might be an easier way. Up until this point, we haven’t localized our game into other languages. For each dialogue, we already have its own event, which is connected in the code. I am using `getLength()` to wait for a certain time and then destroy the subtitle. Ideally, we would like to find a solution that would allow us to:

1. Simply add another sound track with a another one language to the event.
2. Get the duration of this particular sound in the code. (by some way)

I read a forum post from 2022, which mentioned that it’s not possible to get the length of an individual audio track without using a callback. But that was two years ago. Is there any workaround now? For example, could we use different parameters (create two parameters for each localization and get the duration for the specific parameter)? I understand that when there are more than two localizations, all these sounds will be loaded into memory. But for now, we are working on a demo, and I have a feeling that if we implement localization in the “correct” way, we would have to significantly change the engine code and rework all the existing events. Please correct me if I’m wrong.

---

<div class="post-metadata">

**Author:** ![li\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/li_fmod/32/6577_2.png) [@li\_fmod](https://qa.fmod.com/u/li_fmod)\
**Post date:** [October 15, 2024, 3:56am UTC](https://qa.fmod.com/t/problem-with-voiceovers-in-different-languages/22039/5 "2024-10-15T03:56:06Z")

</div>

Hi,

Thank you for sharing the information.

What version of UE and the integration are you using?

> [@BashOrgRu](#):
>
> For each dialogue, we already have its own event, which is connected in the code.

Could you elaborate on this please?

> [@BashOrgRu](#):
>
> I read a forum post from 2022, which mentioned that it’s not possible to get the length of an individual audio track without using a callback. But that was two years ago. Is there any workaround now?

As of the latest version of FMOD, there is still no direct way to retrieve the length of an individual audio track without using callbacks.

You could consider recursively searching a ChannelGroup and all its sub-groups to find and return the current active sound playing, which you could then retrieve its length. Please refer to  
[Channel::getChannelGroup](https://fmod.com/docs/2.02/api/core-api-channel.html#channel_getchannelgroup)  
[ChannelGroup::getNumChannels](https://fmod.com/docs/2.02/api/core-api-channelgroup.html#channelgroup_getnumchannels)  
[ChannelGroup::getNumGroups](https://fmod.com/docs/2.02/api/core-api-channelgroup.html#channelgroup_getnumgroups)  
[Channel::getCurrentSound](https://fmod.com/docs/2.02/api/core-api-channel.html#channel_getcurrentsound)

> [@BashOrgRu](#):
>
> Simply add another sound track with a another one language to the event.

You could indeed create a parameter sheet to control the language switch and automate the volume of each track based on the parameter index(0 = English, 1 = Japanese, 2 = Chinese .etc) and called [Studio::EventInstance::setParameterByName](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#studio_eventinstance_setparameterbyname) via code to set target language index:

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcuPdOfeHMqQMzRZIawaKCUQJ2oHlOwfDfEtBPRuwXFZGbxdrYTJB56w6zkxrv9XODst7HAFzKdsXthTPs_VIWO7X1dLCV3A1iiVaDPSQ4Rlm-6F1Lu7ZZZR5EgECsFgTMfKpUEi3zQeS8oeVHDIBVt6_FL?key=yO63GfOEUQzsiMAVC7VIFg)

> [@BashOrgRu](#):
>
> Get the duration of this particular sound in the code. (by some way)

For simple subtitle timing, you could consider using [Studio::EventInstance::getTimelinePosition](https://fmod.com/docs/2.02/api/studio-api-eventinstance.html#studio_eventinstance_gettimelineposition) along with `getLength()` to manually check if the current event has finished. This approach could be a temporary solution for a demo release but please note that it is less efficient and precise compared to using callbacks.

> [@BashOrgRu](#):
>
> I understand that when there are more than two localizations, all these sounds will be loaded into memory. But for now, we are working on a demo, and I have a feeling that if we implement localization in the “correct” way, we would have to significantly change the engine code and rework all the existing events. Please correct me if I’m wrong.

You are correct that loading multiple audio tracks for localization into memory could be an issue and might impact your games’ coding structure, but for a demo release, this might be acceptable.

> [@BashOrgRu](#):
>
> We haven’t fully figured out yet how to properly implement localization using “event callback,” “audio table,” and “programming sounds.” We will definitely look into this.

There’s a similar post that might help you understand how to set up localization with `programmer sound` and `audio table` if you decide to implement that in the future: [Parameter to swap between programmer instruments](https://qa.fmod.com/t/parameter-to-swap-between-programmer-instruments/21970)

You could also consider having a look at our [callback scripting example](https://fmod.com/docs/2.02/api/studio-guide.html#scripting-example) for reference.

Hope this helps, let me know if you have any questions.
