Unity 3d tutorial on syncing text with audio

In this tutorial, we will learn to sync text in with audio as shown in the video below.

We will be using the Unity asset Audio-Text synchronizer for this purpose.

Step 1: Get the asset

  1. Go to Audio text synchronizer assets on the Unity asset store.
  2. Login using your Unity Id and add Audio text synchronizer to your assets.
  3. Go to Unity editor and open package manager.
  4. Find Audio text synchronizer and import the asset into your project.

Step 2: Add Audio clip to timing editor.

Create>audio timings
  1. Go to Projects window.
  2. Click create>Audio Timing.
  3. You should see a timing editor in the screen.
  4. Add your audio clip to the timing editor.
add audio clip

Step3: Add time segments

Since the audio will not be evenly distributed. It’s better to create segments in the audio clip and add the respective text to it.

  1. Double Click on the timeline where you want to add the timing.
  2. Click add timing at the bottom of the Timings editor.
  3. You can see a segment is created and highlighted.
  4. You can hold Shift key to move this segment and move the borders to adjust the duration.
  5. Add the text that in the audio to the segment.
  6. Press the play button in the Timings editor and see if the text is in sync.
  7. Keep adding segments and enter text for the complete audio file.
  8. After completing save the audio asset using the save option in the Timings editor.

Step4: Display text effect

  1. Create a new text object.
  2. Create a new audio source and add the audio clip to it. Make sure the clip is set to not play on awake.
  3. Create an empty game object and name it Voiceandvisualtextsynchronizer.
  4. Add Text Synchronizer script to Voiceandvisualtextsynchronizer.
  5. Add the text to the gameobject parameter.
  6. Select property as text.
  7. Drag and drop the timing asset you created above into the Phrases asset parameter.
  8. Add the audio source.
  9. In the effect field add the component to which the Text synchronizer script is added.
  10. To start use Textsynchronizer.Start()
  11. To stop use Textsynchronizer.Stop()
  12. Note that the audio source must be playing to start the text synchronizer.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from VionixStudio

Subscribe now to keep reading and get access to the full archive.

Continue reading