Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Latest commit

 

History

History
151 lines (107 loc) · 4.78 KB

README.md

File metadata and controls

151 lines (107 loc) · 4.78 KB

Kotoha

license

Kotoha is a .NET library that provides a common API for operations such as VOICEROID2.

Usage

Very simple.

using (var player = new KotohaPlayer())
{
    player.LoadPlugins($@"{Environment.CurrentDirectory}/plugins", recursive: true);
    player.Initialize();

    await player.SpeechAsync("こんにちは", "琴葉 葵");
}

For more information, please see Sample Project.

Plugins

Engine

Engine is UI automation / API call implementation for Text-To-Speech engines.
For example:

  • Engine provides Web API / COM / DLL library -> You should implement API call for Kotoha.
  • Engine doesn't provide APIs, but it has GUI -> You should implement UI automation for Kotoha.

Kotoha use Codeer.Friendly for UI automation. You can use and find it in Kotoha.Plugin.Automation namespace classes.

Example implementation is Kotoha.Engine.Voiceroid2.

Lifecycle

All plugins are loaded when LoadPlugins is called by Application Host.
But, Kotoha doesn't launch/find backend engines (e.g. VOICEROID, CeVIO).

    +-----------+-----------+
    |     LoadPlugins()     |
    +-----------+-----------+
                |
    +-----------+-----------+
    |     constructor()     |
    +-----------+-----------+
                +<------------------------------------------------------------------------------------+
    +-----------+-----------+                                                                         |
    | SpeechAsync(str, str) +                                                                         |
    +-----------+-----------+                                                                         |
                |                                                                                     |
                |                       +-----------+-----------+                                     |
       Already Initialized? ---- No --->+ FindCurrentProcess()  |                                     |
                |                       +-----------+-----------+                                     |
               Yes                                  |                     +-----------------------+   |
                |                           Already Launched? ---- No --->+  FindMainExecutable() |   |
                |                                   |                     +-----------+-----------+   |
                |                                  Yes                                |               |
                |                                   |                                 |               |
                |                       +-----------+-----------+                     |               |
                |                       |   Initialize(IntPtr)  +<--------------------+               |
                |                       +-----------+-----------+                                     |
                |                                   |                                                 |
                +<----------------------------------+                                                 |
                |                                                                                     |
    +-----------+-----------+                                                                         |
    | SpeechAsync(str,talk) +-------------------------------------------------------------------------+
    +-----------+-----------+
                |
    +-----------+-----------+
    |       Dispose()       |
    +-----------+-----------+             

Talkers

You can choose 3-type plugin of talker.

  1. .NET library.
  2. JSON configuration.
  3. Class that implement IKotohaTalker.

Plugins offer the same thing.

  • name : Plugin name that you like. You may need to follow the engine.
  • engine : Text-To-Speech engine name such as VOICEROID2, CeVIO...

.NET library

  1. Create a new project as .NET Desktop library.
  2. Set reference to Kotoha.Plugin.
  3. Implement IKotohaTalker interface.
  4. Build

JSON configuration

You write JSON as below example.

[
  {
    "name": "琴葉 茜",
    "engine": "VOICEROID2"
  },
  {
    "name": "琴葉 葵",
    "engine": "VOICEROID2"
  }
]

and load.

player.LoadConfigs("/path/to/talkers_configuration.json");

Class

Create a new class

internal class Yukari : IKotohaTalker
{
    public string Name => "結月ゆかり";
    public string Engine => "VOICEROID2";
}

and load

player.LoadClasses(new List<IKotohaTalker> { new Yukari() });

Donation

If you want to support me, you can donate cryptocurrencies here.
https://mochizuki.moe/donation