Skip to content

Gemelo.ai Voice Plugin for Unity allows to convert nad stream text-to-speach voice in real time

License

Notifications You must be signed in to change notification settings

charactr-platform/gemelo-unity-plugin

Repository files navigation

Gemelo.ai Voice Plugin for Unity

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.

Notice

Please visit Gemelo.ai for account creation and API keys.

Unity version support

  • 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)

Platform support

  • Mac/Windows
  • Android
  • iOS
  • WebGL

HowTo samples

  • 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");
    }
}

Sample code

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

Source code

The source code for this project is located at: https://github.com/charactr-platform/gemelo-unity-plugin

Resources

About

Gemelo.ai Voice Plugin for Unity allows to convert nad stream text-to-speach voice in real time

Resources

License

Stars

Watchers

Forks

Packages

No packages published