Add Go API for Kokoro TTS models (#1722)
This commit is contained in:
@@ -33,6 +33,12 @@ func main() {
|
||||
flag.Float32Var(&config.Model.Matcha.NoiseScale, "matcha-noise-scale", 0.667, "noise_scale for Matcha")
|
||||
flag.Float32Var(&config.Model.Matcha.LengthScale, "matcha-length-scale", 1.0, "length_scale for Matcha. small -> faster in speech speed; large -> slower")
|
||||
|
||||
flag.StringVar(&config.Model.Kokoro.Model, "kokoro-model", "", "Path to the Kokoro ONNX model")
|
||||
flag.StringVar(&config.Model.Kokoro.Voices, "kokoro-voices", "", "Path to voices.bin for Kokoro")
|
||||
flag.StringVar(&config.Model.Kokoro.Tokens, "kokoro-tokens", "", "Path to tokens.txt for Kokoro")
|
||||
flag.StringVar(&config.Model.Kokoro.DataDir, "kokoro-data-dir", "", "Path to espeak-ng-data for Kokoro")
|
||||
flag.Float32Var(&config.Model.Kokoro.LengthScale, "kokoro-length-scale", 1.0, "length_scale for Kokoro. small -> faster in speech speed; large -> slower")
|
||||
|
||||
flag.IntVar(&config.Model.NumThreads, "num-threads", 1, "Number of threads for computing")
|
||||
flag.IntVar(&config.Model.Debug, "debug", 0, "Whether to show debug message")
|
||||
flag.StringVar(&config.Model.Provider, "provider", "cpu", "Provider to use")
|
||||
|
||||
21
go-api-examples/non-streaming-tts/run-kokoro-en.sh
Executable file
21
go-api-examples/non-streaming-tts/run-kokoro-en.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
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
|
||||
rm kokoro-en-v0_19.tar.bz2
|
||||
fi
|
||||
|
||||
go mod tidy
|
||||
go build
|
||||
|
||||
./non-streaming-tts \
|
||||
--kokoro-model=./kokoro-en-v0_19/model.onnx \
|
||||
--kokoro-voices=./kokoro-en-v0_19/voices.bin \
|
||||
--kokoro-tokens=./kokoro-en-v0_19/tokens.txt \
|
||||
--kokoro-data-dir=./kokoro-en-v0_19/espeak-ng-data \
|
||||
--debug=1 \
|
||||
--output-filename=./test-kokoro-en.wav \
|
||||
"Friends fell out often because life was changing so fast. The easiest thing in the world was to lose touch with someone."
|
||||
Reference in New Issue
Block a user