简体   繁体   中英

Android Text to Speech add speech text continuously

I'm currently developing an app for visually impaired people which will read .txt files. I'm thinking about loading texts in blocks with ie 50 chars, that will be something like "page". The problem is how to connect those "blocks" in TTS. I'm using method Tts.speak(speechText, TextToSpeech.QUEUE_ADD, null) and between blocks there is always a space. It's annoying when the word or sentence (because of intonation) is divided with speech space. Isn't there something like "stream" that allows to add speech text to tts continuously and that doesn't give speech spaces?

I know I could divide the text not into pages but to sentences, but not all texts are in sentences so I would have to define some good way how to divide the text. The solution with blocks with same count of chars seems better to me now.

Have you tried to initialize a new TextToSpeech for every 50 chars and start it when the first ends?

Did you define, for example, two different TextToSpeech variables correctly initialized? and though:

1) First 50 chars added to the first queue and at the same time the second 50 chars added to the second queue; 
2) When the first queue ends to reproduce start the second one end rewrite the first one with the third 50 chars; 

I think you should not have some delays. They are necessary when modify one queue but if you will start a new one it should be immediate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM