How do you handle pause and resume of speech when using the Flite libraries?
i have developed sample application in which i have used Flite libraries for Text to Speech conversion. But now i开发者_如何学运维 am not able to get how can i pause and resume speech using API/Classes of Flite, because i think Flite convert our text string as a wav file and then once recording completed then it plays that sound file in background. So when i press button "Pause" how can i know how much of text will be converted into audio output, so that i can start with remaining texts when pressing a resume.
In the FliteTTS.m file you can uncomment the preload audio player and comment out the AV player "play". Then make a new method that calls AV player to play. That way you will have your whole string converted into a file and you can play and pause it at will.
If you are asking how you know which word it will be on when your user hits "pause" - that is tricky - since it is all one audio file you can't.
Maybe you could send flite TTS each word separately, covert them and play them back in series keping track along the way - I have no idea if that will sound very good.
Or use speech recognition to listen to the AV player and guess. Or maybe analyze the string length and time the audioplayer and guess.
精彩评论