Skip to content

Commit

Permalink
Add MFC example for Kokoro TTS 1.0 (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Feb 7, 2025
1 parent f90f9da commit 84c4fe6
Showing 1 changed file with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,26 @@ void CNonStreamingTextToSpeechDlg::Init() {

error_message += "\r\nto download models.\r\n";
error_message += "\r\nWe give several examples below\r\n";
error_message += " 1. Use a Kokoro TTS model\r\n";
error_message += " 2. Use a VITS Piper TTS model\r\n";
error_message += " 3. Use a VITS Chinese TTS model\r\n";
error_message += " 4. Use a Matcha TTS model\r\n";
error_message += " 1. Use a Kokoro TTS model (multi-lingual, e.g, English + Chinese)\r\n";
error_message += " 2. Use a Kokoro TTS model (English only)\r\n";
error_message += " 3. Use a VITS Piper TTS model\r\n";
error_message += " 4. Use a VITS Chinese TTS model\r\n";
error_message += " 5. Use a Matcha TTS model\r\n";
error_message += "\r\n";

error_message +=
"----------1. Use a Kokoro TTS model----------\r\n"
"----------1. Use a Kokoro TTS model (multi-lingual, eg., English + Chinese)----------\r\n"
"(a) Download the model from \r\n"
" https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-multi-lang-v1_0.tar.bz2\r\n"
"(b) Uncompress it and you will get a directory kokoro-multi-lang-v1_0\r\n"
"(c) Switch to the directory kokoro-multi-lang-v1_0\r\n"
"(d) Copy the current exe to the directory kokoro-multi-lang-v1_0\r\n"
"(e).Done! You can now run the exe in the directory kokoro-multi-lang-v1_0\r\n";

error_message += "\r\n";

error_message +=
"----------2. Use a Kokoro TTS model (English only)----------\r\n"
"(a) Download the model from \r\n"
" https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2\r\n"
"(b) Uncompress it and you will get a directory kokoro-en-v0_19\r\n"
Expand All @@ -470,7 +483,7 @@ void CNonStreamingTextToSpeechDlg::Init() {
error_message += "\r\n";

error_message +=
"----------2. Use a VITS Piper TTS model----------\r\n"
"----------3. Use a VITS Piper TTS model----------\r\n"
"(a) Download the model from \r\n"
" https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2\r\n"
"(b) Uncompress it and you will get a directory vits-piper-en_US-amy-low\r\n"
Expand All @@ -482,7 +495,7 @@ void CNonStreamingTextToSpeechDlg::Init() {
error_message += "\r\n";

error_message +=
"----------3. Use a VITS Chinese TTS model----------\r\n"
"----------4. Use a VITS Chinese TTS model----------\r\n"
"(a) Download the model from \r\n"
" https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2\r\n"
"(b) Uncompress it and you will get a directory sherpa-onnx-vits-zh-ll\r\n"
Expand All @@ -493,7 +506,7 @@ void CNonStreamingTextToSpeechDlg::Init() {
error_message += "\r\n";

error_message +=
"----------4. Use a Matcha TTS model----------\r\n"
"----------5. Use a Matcha TTS model----------\r\n"
"(a) Download the model from \r\n"
" https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-icefall-zh-baker.tar.bz2\r\n"
"(b) Uncompress it and you will get a directory matcha-icefall-zh-baker\r\n"
Expand Down Expand Up @@ -523,6 +536,10 @@ void CNonStreamingTextToSpeechDlg::Init() {
config.model.kokoro.voices = "./voices.bin";
config.model.kokoro.tokens = "./tokens.txt";
config.model.kokoro.data_dir = "./espeak-ng-data";
if (Exists("./dict/jieba.dict.utf8") && Exists("./lexicon-zh.txt")) {
config.model.kokoro.dict_dir = "./dict";
config.model.kokoro.lexicon = "./lexicon-us-en.txt,./lexicon-zh.txt";
}
} else if (Exists("./hifigan.onnx")) {
// it is a matcha tts model
config.model.matcha.acoustic_model = "./model.onnx";
Expand Down Expand Up @@ -561,6 +578,10 @@ void CNonStreamingTextToSpeechDlg::Init() {
config.rule_fsts = "./phone.fst,./date.fst,number.fst";
}

if (Exists("./phone-zh.fst") && Exists("./date-zh.fst") && Exists("./number-zh.fst")) {
config.rule_fsts = "./phone-zh.fst,./date-zh.fst,number-zh.fst";
}

if (Exists("./rule.far")) {
config.rule_fars = "./rule.far";
}
Expand Down

0 comments on commit 84c4fe6

Please sign in to comment.