Committed by
GitHub
Add MFC example for Kokoro TTS 1.0 (#1815)
正在显示
1 个修改的文件
包含
29 行增加
和
8 行删除
| @@ -453,13 +453,26 @@ void CNonStreamingTextToSpeechDlg::Init() { | @@ -453,13 +453,26 @@ void CNonStreamingTextToSpeechDlg::Init() { | ||
| 453 | 453 | ||
| 454 | error_message += "\r\nto download models.\r\n"; | 454 | error_message += "\r\nto download models.\r\n"; |
| 455 | error_message += "\r\nWe give several examples below\r\n"; | 455 | error_message += "\r\nWe give several examples below\r\n"; |
| 456 | - error_message += " 1. Use a Kokoro TTS model\r\n"; | ||
| 457 | - error_message += " 2. Use a VITS Piper TTS model\r\n"; | ||
| 458 | - error_message += " 3. Use a VITS Chinese TTS model\r\n"; | ||
| 459 | - error_message += " 4. Use a Matcha TTS model\r\n"; | 456 | + error_message += " 1. Use a Kokoro TTS model (multi-lingual, e.g, English + Chinese)\r\n"; |
| 457 | + error_message += " 2. Use a Kokoro TTS model (English only)\r\n"; | ||
| 458 | + error_message += " 3. Use a VITS Piper TTS model\r\n"; | ||
| 459 | + error_message += " 4. Use a VITS Chinese TTS model\r\n"; | ||
| 460 | + error_message += " 5. Use a Matcha TTS model\r\n"; | ||
| 460 | error_message += "\r\n"; | 461 | error_message += "\r\n"; |
| 462 | + | ||
| 461 | error_message += | 463 | error_message += |
| 462 | - "----------1. Use a Kokoro TTS model----------\r\n" | 464 | + "----------1. Use a Kokoro TTS model (multi-lingual, eg., English + Chinese)----------\r\n" |
| 465 | + "(a) Download the model from \r\n" | ||
| 466 | + " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-multi-lang-v1_0.tar.bz2\r\n" | ||
| 467 | + "(b) Uncompress it and you will get a directory kokoro-multi-lang-v1_0\r\n" | ||
| 468 | + "(c) Switch to the directory kokoro-multi-lang-v1_0\r\n" | ||
| 469 | + "(d) Copy the current exe to the directory kokoro-multi-lang-v1_0\r\n" | ||
| 470 | + "(e).Done! You can now run the exe in the directory kokoro-multi-lang-v1_0\r\n"; | ||
| 471 | + | ||
| 472 | + error_message += "\r\n"; | ||
| 473 | + | ||
| 474 | + error_message += | ||
| 475 | + "----------2. Use a Kokoro TTS model (English only)----------\r\n" | ||
| 463 | "(a) Download the model from \r\n" | 476 | "(a) Download the model from \r\n" |
| 464 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2\r\n" | 477 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2\r\n" |
| 465 | "(b) Uncompress it and you will get a directory kokoro-en-v0_19\r\n" | 478 | "(b) Uncompress it and you will get a directory kokoro-en-v0_19\r\n" |
| @@ -470,7 +483,7 @@ void CNonStreamingTextToSpeechDlg::Init() { | @@ -470,7 +483,7 @@ void CNonStreamingTextToSpeechDlg::Init() { | ||
| 470 | error_message += "\r\n"; | 483 | error_message += "\r\n"; |
| 471 | 484 | ||
| 472 | error_message += | 485 | error_message += |
| 473 | - "----------2. Use a VITS Piper TTS model----------\r\n" | 486 | + "----------3. Use a VITS Piper TTS model----------\r\n" |
| 474 | "(a) Download the model from \r\n" | 487 | "(a) Download the model from \r\n" |
| 475 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2\r\n" | 488 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_US-amy-low.tar.bz2\r\n" |
| 476 | "(b) Uncompress it and you will get a directory vits-piper-en_US-amy-low\r\n" | 489 | "(b) Uncompress it and you will get a directory vits-piper-en_US-amy-low\r\n" |
| @@ -482,7 +495,7 @@ void CNonStreamingTextToSpeechDlg::Init() { | @@ -482,7 +495,7 @@ void CNonStreamingTextToSpeechDlg::Init() { | ||
| 482 | error_message += "\r\n"; | 495 | error_message += "\r\n"; |
| 483 | 496 | ||
| 484 | error_message += | 497 | error_message += |
| 485 | - "----------3. Use a VITS Chinese TTS model----------\r\n" | 498 | + "----------4. Use a VITS Chinese TTS model----------\r\n" |
| 486 | "(a) Download the model from \r\n" | 499 | "(a) Download the model from \r\n" |
| 487 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2\r\n" | 500 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2\r\n" |
| 488 | "(b) Uncompress it and you will get a directory sherpa-onnx-vits-zh-ll\r\n" | 501 | "(b) Uncompress it and you will get a directory sherpa-onnx-vits-zh-ll\r\n" |
| @@ -493,7 +506,7 @@ void CNonStreamingTextToSpeechDlg::Init() { | @@ -493,7 +506,7 @@ void CNonStreamingTextToSpeechDlg::Init() { | ||
| 493 | error_message += "\r\n"; | 506 | error_message += "\r\n"; |
| 494 | 507 | ||
| 495 | error_message += | 508 | error_message += |
| 496 | - "----------4. Use a Matcha TTS model----------\r\n" | 509 | + "----------5. Use a Matcha TTS model----------\r\n" |
| 497 | "(a) Download the model from \r\n" | 510 | "(a) Download the model from \r\n" |
| 498 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-icefall-zh-baker.tar.bz2\r\n" | 511 | " https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/matcha-icefall-zh-baker.tar.bz2\r\n" |
| 499 | "(b) Uncompress it and you will get a directory matcha-icefall-zh-baker\r\n" | 512 | "(b) Uncompress it and you will get a directory matcha-icefall-zh-baker\r\n" |
| @@ -523,6 +536,10 @@ void CNonStreamingTextToSpeechDlg::Init() { | @@ -523,6 +536,10 @@ void CNonStreamingTextToSpeechDlg::Init() { | ||
| 523 | config.model.kokoro.voices = "./voices.bin"; | 536 | config.model.kokoro.voices = "./voices.bin"; |
| 524 | config.model.kokoro.tokens = "./tokens.txt"; | 537 | config.model.kokoro.tokens = "./tokens.txt"; |
| 525 | config.model.kokoro.data_dir = "./espeak-ng-data"; | 538 | config.model.kokoro.data_dir = "./espeak-ng-data"; |
| 539 | + if (Exists("./dict/jieba.dict.utf8") && Exists("./lexicon-zh.txt")) { | ||
| 540 | + config.model.kokoro.dict_dir = "./dict"; | ||
| 541 | + config.model.kokoro.lexicon = "./lexicon-us-en.txt,./lexicon-zh.txt"; | ||
| 542 | + } | ||
| 526 | } else if (Exists("./hifigan.onnx")) { | 543 | } else if (Exists("./hifigan.onnx")) { |
| 527 | // it is a matcha tts model | 544 | // it is a matcha tts model |
| 528 | config.model.matcha.acoustic_model = "./model.onnx"; | 545 | config.model.matcha.acoustic_model = "./model.onnx"; |
| @@ -561,6 +578,10 @@ void CNonStreamingTextToSpeechDlg::Init() { | @@ -561,6 +578,10 @@ void CNonStreamingTextToSpeechDlg::Init() { | ||
| 561 | config.rule_fsts = "./phone.fst,./date.fst,number.fst"; | 578 | config.rule_fsts = "./phone.fst,./date.fst,number.fst"; |
| 562 | } | 579 | } |
| 563 | 580 | ||
| 581 | + if (Exists("./phone-zh.fst") && Exists("./date-zh.fst") && Exists("./number-zh.fst")) { | ||
| 582 | + config.rule_fsts = "./phone-zh.fst,./date-zh.fst,number-zh.fst"; | ||
| 583 | + } | ||
| 584 | + | ||
| 564 | if (Exists("./rule.far")) { | 585 | if (Exists("./rule.far")) { |
| 565 | config.rule_fars = "./rule.far"; | 586 | config.rule_fars = "./rule.far"; |
| 566 | } | 587 | } |
-
请 注册 或 登录 后发表评论