Support German TTS (#394)

This commit is contained in:
Fangjun Kuang
2023-10-27 11:12:45 +08:00
committed by GitHub
parent 93ef4ee4bc
commit fbf4c903e1
3 changed files with 15 additions and 12 deletions

View File

@@ -77,20 +77,13 @@ class MainActivity : AppCompatActivity() {
return
}
Toast.makeText(applicationContext, "Generating...Please wait", Toast.LENGTH_LONG).show()
play.isEnabled = false;
val audio = tts.generate(text = textStr, sid = sidInt, speed = speedFloat)
val filename = application.filesDir.absolutePath + "/generated.wav"
val ok = audio.samples.size > 0 && audio.save(filename)
if (ok) {
play.isEnabled = true
Toast.makeText(
applicationContext,
"Generated! Please click play to listen to it",
Toast.LENGTH_LONG
).show()
} else {
play.isEnabled = false
}
}
@@ -110,4 +103,4 @@ class MainActivity : AppCompatActivity() {
val config = getOfflineTtsConfig(type = type, debug = true)!!
tts = OfflineTts(assetManager = application.assets, config = config)
}
}
}