Support playing as it is generating for Android (#477)
This commit is contained in:
@@ -2,6 +2,10 @@ package com.k2fsa.sherpa.onnx
|
||||
|
||||
import android.content.res.AssetManager
|
||||
|
||||
fun callback(samples: FloatArray): Unit {
|
||||
println("callback got called with ${samples.size} samples");
|
||||
}
|
||||
|
||||
fun main() {
|
||||
testTts()
|
||||
testAsr()
|
||||
@@ -22,7 +26,7 @@ fun testTts() {
|
||||
)
|
||||
)
|
||||
val tts = OfflineTts(config=config)
|
||||
val audio = tts.generate(text="“Today as always, men fall into two groups: slaves and free men. Whoever does not have two-thirds of his day for himself, is a slave, whatever he may be: a statesman, a businessman, an official, or a scholar.”")
|
||||
val audio = tts.generateWithCallback(text="“Today as always, men fall into two groups: slaves and free men. Whoever does not have two-thirds of his day for himself, is a slave, whatever he may be: a statesman, a businessman, an official, or a scholar.”", callback=::callback)
|
||||
audio.save(filename="test-en.wav")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user