Making subtitles with voice soundtrack channel - Tomb-Raider-Level-Editor/Tutorials GitHub Wiki
With TEN 1.1.0, you are now able to make subtitles much easier with the new voice soundtrack channel. this tutorial teaches you how to do that.
Part 1: Downloading Subtitle edit
In order to start making subtitles, you will need subtitle edit which is a program to add subtitles to the audio.
So search for subtitle edit in your favourite search engine or go to this link: https://www.nikse.dk/subtitleedit then click on “Download latest version of Subtitle Edit”
After going through the usual installation process you can now launch Subtitle Edit and get to know it’s layout.
So this is how the program looks, on the right hand side you have the preview when you play the audio and add the subtitles. At the bottom you have waveform which can also be extremely useful to adjust the time of subtitles appearing in relation to the audio. The left hand side will have all the subtitles you made.
Part 2: Making subtitles
Now we are going to load an audio and add a bunch of subtitles to it. Go to the navigation bar and click video -> open video file… (Don’t worry as you can also import Audio and videos to the program but we are only concerned with Audio)
After importing, you can play the audio on the right hand side with blue play button.
Now, you can start adding subtitles, but first click on “click to add waveform” this will help you adding subtitles. Next click on the textbox and the red outline should appear on the waveform with ability to add text.
Now add text and adjust the bar as you wish. It now should look like this:
Now you can do that for the whole audio. Right click on the subtitles tab and click “insert new line” and a red waveform will again appear so you can adjust the length etc etc. A completed subtitle program could look like this:
Part 3: integrating into the level
Now after we complete subtitles, it is time to insert it into our level. Save the .srt file into your Audio folder (THE .SRT FILE NAME AND .WAV MUST MATCH AND BE TOGETHER IN THE AUDIO FOLDER)
Now there are 2 ways to draw the subtitle: Lua and nodes.
The Lua way.
Go to your lua level file and insert this to OnControlPhase: (Can be anywhere, but for tutorial purposes I put in OnControlPhase)
local subtitle = GetCurrentSubtitle()
if (subtitle ~= '') then
local x, y = PercentToScreen(50, 80)
local str = DisplayString(subtitle, x, y, TEN.Color(255,255,255), false)
ShowString(str, 1/30)
end
This is a relatively simple block of code, what it does it the variable subtitle will fetch the subtitle text from .srt file IF and only IF the soundtrack is playing in a Voice channel. Then it displays it if something was found. Otherwise it won’t display.
Note: keep the 1/30 in the ShowString, otherwise if you put 1 second then the string will overlay on each other every frame, and you will get 30 similar strings, resulting in an extremely oversaturated string
Now go to Tomb Editor event set and insert a new event set with a node to play soundtrack in voice channel:
Now you can play the game and see the magic: https://streamable.com/fol53l
you can see in the video, the channel and subtitles will stop when in pause or inventory menu so that both do not go out of sync.
The nodes way
Go to your event set that you created, and switch to “when inside” event. And insert the following node:
This will draw the subtitle string like the Lua way. NOTE: You still need to play the audio in voice channel!
However, this comes with certain limitations, because the volume boxes need to be adjusted so that the text can appear, especially if you have cutscenes in your level, considering that volume boxes cannot span across the room (as of TE 1.7 they now can by checking the checkbox at the bottom left of the volume window ). You are probably good to go with the Lua way so it works in all 100% cases.
Frequently Asked Questions (Optional section - updated regularly)
Q: My subtitles are not displaying the final line for some reason. What should I do?
A: Open the SRT file with a text editor, scroll to the very bottom of the file and add an additional line by pressing enter, that should fix the final line not showing in game.