In Android ---- How can we give a hint, what word does Text to Speech say?

Does any body help me give a hint in a text for speech?

I get the word in the array, but TextToSpeech.QUEUE_ADD takes a few seconds to speak and makes the bold word run fast.

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 not understand tts.speak last parameter ( myHashAlarm ). How it works?

thanks

+2
source share

All Articles