Add Java and Koltin API for Kokoro TTS 1.0 (#1798)
This commit is contained in:
@@ -115,6 +115,12 @@ function testTts() {
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/vocoder-models/hifigan_v2.onnx
|
||||
fi
|
||||
|
||||
if [ ! -f ./kokoro-multi-lang-v1_0/model.onnx ]; then
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-multi-lang-v1_0.tar.bz2
|
||||
tar xf kokoro-multi-lang-v1_0.tar.bz2
|
||||
rm kokoro-multi-lang-v1_0.tar.bz2
|
||||
fi
|
||||
|
||||
if [ ! -f ./kokoro-en-v0_19/model.onnx ]; then
|
||||
curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-en-v0_19.tar.bz2
|
||||
tar xf kokoro-en-v0_19.tar.bz2
|
||||
|
||||
@@ -3,10 +3,34 @@ package com.k2fsa.sherpa.onnx
|
||||
fun main() {
|
||||
testVits()
|
||||
testMatcha()
|
||||
testKokoro()
|
||||
testKokoroEn()
|
||||
testKokoroZhEn()
|
||||
}
|
||||
|
||||
fun testKokoro() {
|
||||
fun testKokoroZhEn() {
|
||||
// see https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models
|
||||
var config = OfflineTtsConfig(
|
||||
model=OfflineTtsModelConfig(
|
||||
kokoro=OfflineTtsKokoroModelConfig(
|
||||
model="./kokoro-multi-lang-v1_0/model.onnx",
|
||||
voices="./kokoro-multi-lang-v1_0/voices.bin",
|
||||
tokens="./kokoro-multi-lang-v1_0/tokens.txt",
|
||||
dataDir="./kokoro-multi-lang-v1_0/espeak-ng-data",
|
||||
dictDir="./kokoro-multi-lang-v1_0/dict",
|
||||
lexicon="./kokoro-multi-lang-v1_0/lexicon-us-en.txt,./kokoro-multi-lang-v1_0/lexicon-zh.txt",
|
||||
),
|
||||
numThreads=2,
|
||||
debug=true,
|
||||
),
|
||||
)
|
||||
val tts = OfflineTts(config=config)
|
||||
val audio = tts.generateWithCallback(text="中英文语音合成测试。This is generated by next generation Kaldi using Kokoro without Misaki. 你觉得中英文说的如何呢?", callback=::callback)
|
||||
audio.save(filename="test-kokoro-zh-en.wav")
|
||||
tts.release()
|
||||
println("Saved to test-kokoro-zh-en.wav")
|
||||
}
|
||||
|
||||
fun testKokoroEn() {
|
||||
// see https://github.com/k2-fsa/sherpa-onnx/releases/tag/tts-models
|
||||
var config = OfflineTtsConfig(
|
||||
model=OfflineTtsModelConfig(
|
||||
|
||||
Reference in New Issue
Block a user