This is the UPM package for the Gemelo.ai Voice Plugin.
Install it via menu Window/Package Manager->Add package from Git url in Unity:
https://github.com/charactr-platform/gemelo-unity-plugin.git#v1.4.1
Please restart Unity Editor after package installation.
Please visit Gemelo.ai for account creation and API keys.
- Developed and tested on Unity 2021 LTS (2021.3.30)
- Tested on Unity 2022 LTS (2022.3.1)
- Tested on Unity 2023 LTS (2023.3.0b3)
- Mac/Windows
- Android
- iOS
- WebGL
- Play VoiceLibrary item:
//Reference assemblies Gemelo.Voice and Gemelo.Voice.Audio if assembly definitions are used
using Gemelo.Voice.Audio;
using Gemelo.Voice.Library;
using UnityEngine;
public class PlayVoiceLibrary : MonoBehaviour
{
//SerializedObject containing voice items list
[SerializeField] private VoiceLibrary voiceLibrary;
//ID of single voice item from VoiceLibrary
[SerializeField] private int itemId;
void Start()
{
PlayVoiceClipById(itemId);
}
private void PlayVoiceClipById(int id)
{
if (voiceLibrary.GetAudioClipById(id, out var audioClip))
AudioPlayer.PlayClipStatic(audioClip);
}
}
- Create runtime instance of VoiceLibrary:
//Reference assembly Gemelo.Voice if assembly definitions are used
using Gemelo.Voice.Library;
using UnityEngine;
public class CreateVoiceLibraryInstance : MonoBehaviour
{
private VoiceLibrary _voiceLibrary;
void Start()
{
_voiceLibrary = ScriptableObject.CreateInstance<VoiceLibrary>();
var id = _voiceLibrary.AddNewItem("Hello world", 151);
DownloadClipForItem(id);
}
//Note: While working in editor mode, clips are saved to Project/Assets/Audio folder
private async void DownloadClipForItem(int id)
{
await _voiceLibrary.AddAudioClip(id);
_voiceLibrary.GetItemById(id, out var item);
Debug.Log($"Clip downloaded: {item.AudioClip.length} seconds");
}
}
This package contains two example scenes with both Convert API and Steaming API:
Use top menu Tools->Gemelo.ai Voice->Configuration to provide API access keys first!
- Samples/Streaming - TTS realtime streaming example with different voices switching
- Samples/Convert - Convert API tools for offline audio clips and dialogue creation
The source code for this project is located at: https://github.com/charactr-platform/gemelo-unity-plugin