In Android----How can we provide hint which word is speaking in Text to Speech?

爷,独闯天下 提交于 2019-12-22 17:20:13

问题


Any body help me to Provide hint in Text to Speech?

I get word in Array but TextToSpeech.QUEUE_ADD takes a few seconds to speak and makes bold word run speedily.

My Code is below :-(tts is a TextToSpeech object)

String[] strArr = txtText.getText().toString().split(" ");
txtText.setText("");
for(int i=0;i<strArr.length;i++)
{
   Log.d("","Value :- "+strArr[i]);
   HashMap<String, String> myHashAlarm = new HashMap<String, String>();
   myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_NOTIFICATION));
   myHashAlarm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "test");
   tts.speak(strArr[i], TextToSpeech.QUEUE_ADD,myHashAlarm);
   txtText.append(Html.fromHtml("<b>" + strArr[i] + "</b>"+" "));
}

Also I can't Understand tts.speak last parameter(myHashAlarm). How does it work?

Thanks

来源:https://stackoverflow.com/questions/14701602/in-android-how-can-we-provide-hint-which-word-is-speaking-in-text-to-speech

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!