Add C++ runtime for MeloTTS (#1138)

This commit is contained in:
Fangjun Kuang
2024-07-16 15:55:02 +08:00
committed by GitHub
parent 95485411fa
commit 960eb7529e
51 changed files with 693 additions and 156 deletions

View File

@@ -78,6 +78,10 @@ sed -i.bak s/"lang = null"/"lang = \"$lang_iso_639_3\""/ ./TtsEngine.kt
git diff
popd
if [[ $model_dir == vits-melo-tts-zh_en ]]; then
lang=zh_en
fi
for arch in arm64-v8a armeabi-v7a x86_64 x86; do
log "------------------------------------------------------------"
log "build tts apk for $arch"

View File

@@ -76,6 +76,10 @@ sed -i.bak s/"modelName = null"/"modelName = \"$model_name\""/ ./MainActivity.kt
git diff
popd
if [[ $model_dir == vits-melo-tts-zh_en ]]; then
lang=zh_en
fi
for arch in arm64-v8a armeabi-v7a x86_64 x86; do
log "------------------------------------------------------------"
log "build tts apk for $arch"

View File

@@ -312,6 +312,11 @@ def get_vits_models() -> List[TtsModel]:
model_name="vits-zh-hf-fanchen-wnj.onnx",
lang="zh",
),
TtsModel(
model_dir="vits-melo-tts-zh_en",
model_name="model.onnx",
lang="zh",
),
TtsModel(
model_dir="vits-zh-hf-fanchen-C",
model_name="vits-zh-hf-fanchen-C.onnx",
@@ -339,18 +344,21 @@ def get_vits_models() -> List[TtsModel]:
),
]
rule_fsts = ["phone.fst", "date.fst", "number.fst", "new_heteronym.fst"]
rule_fsts = ["phone.fst", "date.fst", "number.fst"]
for m in chinese_models:
s = [f"{m.model_dir}/{r}" for r in rule_fsts]
if "vits-zh-hf" in m.model_dir or "sherpa-onnx-vits-zh-ll" == m.model_dir:
if (
"vits-zh-hf" in m.model_dir
or "sherpa-onnx-vits-zh-ll" == m.model_dir
or "melo-tts" in m.model_dir
):
s = s[:-1]
m.dict_dir = m.model_dir + "/dict"
else:
m.rule_fars = f"{m.model_dir}/rule.far"
m.rule_fsts = ",".join(s)
if "vits-zh-hf" not in m.model_dir and "zh-ll" not in m.model_dir:
m.rule_fars = f"{m.model_dir}/rule.far"
all_models = chinese_models + [
TtsModel(
model_dir="vits-cantonese-hf-xiaomaiiwn",