Kotoha is a .NET library that provides a common API for operations such as VOICEROID2.
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.
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.
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() |
+-----------+-----------+
You can choose 3-type plugin of talker.
- .NET library.
- JSON configuration.
- 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...
- Create a new project as .NET Desktop library.
- Set reference to
Kotoha.Plugin. - Implement
IKotohaTalkerinterface. - Build
You write JSON as below example.
[
{
"name": "琴葉 茜",
"engine": "VOICEROID2"
},
{
"name": "琴葉 葵",
"engine": "VOICEROID2"
}
]and load.
player.LoadConfigs("/path/to/talkers_configuration.json");Create a new class
internal class Yukari : IKotohaTalker
{
public string Name => "結月ゆかり";
public string Engine => "VOICEROID2";
}and load
player.LoadClasses(new List<IKotohaTalker> { new Yukari() });If you want to support me, you can donate cryptocurrencies here.
https://mochizuki.moe/donation