Fix android tts audio buffer size and fix CI. (#478)

This commit is contained in:
Fangjun Kuang
2023-12-10 18:25:50 +08:00
committed by GitHub
parent 0f053d8040
commit 80d0192325
11 changed files with 21 additions and 12 deletions

View File

@@ -61,7 +61,11 @@ class MainActivity : AppCompatActivity() {
private fun initAudioTrack() {
val sampleRate = tts.sampleRate()
val bufLength = (sampleRate * 0.1).toInt()
val bufLength = AudioTrack.getMinBufferSize(
sampleRate,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_FLOAT
)
Log.i(TAG, "sampleRate: ${sampleRate}, buffLength: ${bufLength}")
val attr = AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)