Setup your Project
To configure your Resemble plugin on Unity you can go to :
Edit > Preferences > Resemble
Your unity project must be connected to a Resemble Project. For this you can go to the Project page.
You have to enter your Resemble token, you can find it here : Resemble token
Then, you can bind a project from the list.
Create a Speech
To create a new Speech, you can select
Assets > Create > Resemble Speech
or right-click on a folder in your Project window and select
Create > Resemble Speech
Create a clip
You can create multiple clips in a speech that will all share the same voice. This is also a convenient way to organize your clips (see “Use a speech in your scripts”).
So first you need to select a voice. Then you can add clips with the [Add] button or import existing clips from your Resemble project with [Import].
Write your text, click generate and your audio file will be created.
To change the path of the generated files you can go to :
Preferences > Resemble > Paths
When you start the generation of a file, a placeholder is directly generated. You can already reference it in your scripts or your scene. It will be automatically replaced by the generated version without breaking any links.
Use emotions
You can add emotion to your texts. To do this, select the desired text portion and clic on “Add Emotion”.
- You can always edit an emotion by placing your cusor over it and the clicking on “Edit”.
- You can also edit and emotion by shift + right-click on it.
- To remove an emotion, put your cursor on it or select the desired area and click on “Remove”.
The context menu (right-click) allows you to manage emotion quickly.You can also shift + rightClick on an emotion to edit it directly.
Use a Speech in your scripts
You can use Speech in your script. this can be handy to keep your data organized.
using UnityEngine;
using Resemble;
public class Orator : MonoBehaviour
{
public Speech mySpeech;
// Find and play the clip of the given name.
public void PlayDialogue(string name)
{
AudioClip audioclip = mySpeech.GetAudio(name);
AudioSource.PlayClipAtPoint(audioClip, transform.position);
}
}
UserData
With the UserData, you can also store useful information when you create your clips in order to access them later in your scripts.
In the example below, if the funtion is called with dialogIndex = 3. Allclips of the speech containing the Dialogue tag with a value of 3 will be return.
using System.Collections.Generic;
using UnityEngine;
using Resemble;
public class Orator : MonoBehaviour
{
public Speech mySpeech;
// Returns a list containing all choices for the dialog at the given index.
public list<string> GetDialogueWheelChoices(int dialogueIndex)
{
Label label = new Label(“Dialogue”, dialogueIndex);
List<Clip> mySpeech.GetClipsWithLabel(label);
List<string> choiceName = new List<string>();
foreach (var clip in clips)
choiceName.Add(clip.userdata);
return choiceName;
}
}
Generate One-Shot clips
You can generate oneShot clips. This method allows you to quickly create audio files without saving clips to the Resemble project.
To open the one-shot window go to :
Window > Audio > Resemble
And select the OneShot tab.
The window works like a classic clip. You enter your text, choose a voice, then press the generate button.
Choose the path and the name of the file and the generation will start.
The file will be generated in the background. You can see its progress in the Pending Request Tab. Once the generation is complete you will receive a notification.
When you start the generation of a file, a placeholder is directly generated. You can already reference it in your scripts or your scene. It will be automatically replaced by the generated version without breaking any links.