Skip to content

unipotent/KokoroSharpUnity

 
 

Repository files navigation

This is an adapted version of KokoroSharp that updates the C# 9+ syntax and uses a KokoroWaveOutEvent for Unity audio sources to make it usable in Unity. This package includes the eSpeak NG dlls from https://github.com/Lyrcaxis/KokoroSharpBinaries, where you can also get the voices by running the download script. The voices are expected to be in Assets/StreamingAssets/Kokoro/voices.

You can install this package by:

  1. Opening your Unity project
  2. Opening the Package Manager (Window > Package Manager)
  3. Click the "+" button in the top-left
  4. Select "Add package from git URL..."
  5. Enter the repository URL: https://github.com/unipotent/KokoroSharpUnity.git
  6. Click "Add"

Dependencies

This package requires the package com.github.asus4.onnxruntime Be sure to follow the installation instructions from their readme.

Usage

  • Add voices as mentioned above
  • Add the KokoroUnity component to a GameObject, and drag in your audio source.

Example code:

using KokoroSharp;
using KokoroSharp.Core;

void Start()
{
    KokoroTTS kokoroTTS = KokoroTTS.LoadModel();
    KokoroVoice voice = KokoroVoiceManager.GetVoice("af_heart");
    kokoroTTS.SpeakFast("Hello World!", voice);
}

Tested on Unity 6, Windows 11 on CPU

License

About

This is an attempt to integrate the KokoroSharp library into unity.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%