# Audio duration for subtitles in UE5

**URL:** <https://forum.convai.com/t/audio-duration-for-subtitles-in-ue5/1720>\
**Category:** Unreal Engine Plugin\
**Tags:** question, unreal-engine\
**Created:** [September 19, 2024, 9:18pm UTC](https://forum.convai.com/t/audio-duration-for-subtitles-in-ue5/1720 "2024-09-19T21:18:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)\
**Post date:** [September 19, 2024, 9:18pm UTC](https://forum.convai.com/t/audio-duration-for-subtitles-in-ue5/1720/1 "2024-09-19T21:18:17Z")

</div>

**Original Discord Post by heivoll | 2024-09-19 21:18:17**

We are setting up a game UI in UE5 where we display the subtitles as speech is coming in - more like TV subtitles than a chatlog/chatbox. However, when using the On Text Received event, it seems that text comes in with a way too short audio duration, and then some durations come in without text later than that. However, there is a mix of incoming and durations that don’t seem correct. Is there a way to set up subtitles that show up as the character are saying them?

Example of incoming text events:

- Text 1: Delay 1.755s
- Text 2: Delay: 2.132s
- Text 3: Delay: 1.42s
- (No text) Delay: 1.5124s
- (No text) Delay: 4.123s
- (No text) Delay: 3.2122s
- (No text) Delay: 4.321s

As far as I can tell there is no way of knowing which delay belongs to which text here.

---

<div class="post-metadata">

**Author:** ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)\
**Post date:** [September 22, 2024, 9:38pm UTC](https://forum.convai.com/t/audio-duration-for-subtitles-in-ue5/1720/2 "2024-09-22T21:38:19Z")

</div>

**Reply by k3kalinix | 2024-09-22 21:38:19**

\<@&1163218672580575372\>

---

<div class="post-metadata">

**Author:** ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)\
**Post date:** [October 4, 2024, 5:54am UTC](https://forum.convai.com/t/audio-duration-for-subtitles-in-ue5/1720/3 "2024-10-04T05:54:27Z")

</div>

**Reply by mighty\_brute | 2024-10-04 05:54:27**

Hello \<@535882617170558986\> , Currently, the way our backend works doesn’t guarantee precise timing for the **OnTextReceived** event. While you receive the text, the timing may not always match perfectly with the audio.

For your specific case, I recommend a workaround. You can use the **GetTalkingTimeRemaining** function in the Convai Chatbot to calculate the remaining speaking time and display the appropriate text based on the percentage of the speech completed. This should help synchronize the subtitles more effectively.

---

<div class="post-metadata">

**Author:** ![K3](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.convai.com/k3/32/2611_2.png) [@K3](https://forum.convai.com/u/K3)\
**Post date:** [November 25, 2024, 12:14pm UTC](https://forum.convai.com/t/audio-duration-for-subtitles-in-ue5/1720/4 "2024-11-25T12:14:21Z")

</div>

Closed on November 25, 2024, 12:14pm UTC

This conversation happened on the Convai Discord Server, so this post will be closed.
