Best code examples for Android TextToSpeech class (android.speech.tts.TextToSpeech)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android TextToSpeech class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android TextToSpeech examples from Open Source projects
This code example shows how to use the following methods: getFeatures, getLanguage, isLanguageAvailable, speak
287:	Set<String> features = mTts.getFeatures(mTts.getLanguage()); 
-
310:	(mTts.isLanguageAvailable(mTts.getLanguage()) >= TextToSpeech.LANG_AVAILABLE)) { 
-
314:	mTts.speak(sample, TextToSpeech.QUEUE_FLUSH, params); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods:
73:	mTts = new TextToSpeech(context, (OnInitListener)this); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLanguage
45:	myTTS = new TextToSpeech(this, this); 
46:	myTTS.setLanguage(Locale.US); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLanguage, setPitch, setSpeechRate, speak
64:	int result = mTts.setLanguage(Locale.UK); 
-
77:	mTts.setPitch(1.6f); 
78:	mTts.setSpeechRate(1.05f); 
-
93:	mTts.speak(message, 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLanguage
64:	int result = mTts.setLanguage(Locale.US); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnUtteranceProgressListener
150:	mTts.setOnUtteranceProgressListener(new UtteranceProgressListener() { 
-
426:	mPreviousEngine); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLanguage, setOnUtteranceCompletedListener, shutdown, stop
93:	mTts.stop(); 
94:	mTts.shutdown(); 
-
101:	int result = mTts.setLanguage(Locale.ENGLISH); 
-
104:	mTts.setOnUtteranceCompletedListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isLanguageAvailable, setLanguage, setPitch, setSpeechRate
51:	if (tts.isLanguageAvailable(locale) >= 
-
53:	tts.setLanguage(locale); 
54:	tts.setPitch(1.5f); 
55:	tts.setSpeechRate(1.5f); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addEarcon, playEarcon
568:	mTts.addEarcon(earconName, getPackageName(), resourceId); 
-
573:	mTts.playEarcon(earconName, QUEUING_MODE_INTERRUPT, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isLanguageAvailable, setLanguage, setOnUtteranceCompletedListener, setSpeechRate, sleep
152:	mTts.setOnUtteranceCompletedListener(this); 
-
155:	int result = mTts.isLanguageAvailable(l); 
-
160:	mTts.setLanguage(l); 
-
166:	mTts.setSpeechRate(0.85f); 
-
194:	Thread.sleep(1000); 
-
205:	m.play(mTts); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLanguage
176:	mTts.setLanguage(Locale.US); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isLanguageAvailable, setLanguage, setOnUtteranceCompletedListener, setPitch, speak
44:	tts.setPitch(0.5f); 
45:	switch (tts.isLanguageAvailable(locale)) 
-
51:	tts.setLanguage(locale); 
-
67:	tts.speak(message, TextToSpeech.QUEUE_ADD, hashAudio); 
-
79:	int listenerResult = tts.setOnUtteranceCompletedListener(this); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: stop
81:	tts.stop(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isLanguageAvailable, setLanguage, setOnUtteranceCompletedListener, setOnUtteranceProgressListener, speak
64:	if (myTTS.isLanguageAvailable(Locale.UK) == TextToSpeech.LANG_COUNTRY_AVAILABLE) { 
65:	myTTS.setLanguage(Locale.UK); 
-
68:	myTTS.setOnUtteranceProgressListener(new UtteranceProgressListener() { 
-
88:	myTTS.setOnUtteranceCompletedListener(new TextToSpeech.OnUtteranceCompletedListener() { 
-
141:	myTTS.speak(string, 1, hashMap); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: shutdown, stop
80:	mTts.stop(); 
81:	mTts.shutdown(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: addEarcon, playEarcon
568:	mTts.addEarcon(earconName, getPackageName(), resourceId); 
-
573:	mTts.playEarcon(earconName, QUEUING_MODE_INTERRUPT, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getFeatures, getLanguage, isLanguageAvailable, speak
287:	Set<String> features = mTts.getFeatures(mTts.getLanguage()); 
-
310:	(mTts.isLanguageAvailable(mTts.getLanguage()) >= TextToSpeech.LANG_AVAILABLE)) { 
-
314:	mTts.speak(sample, TextToSpeech.QUEUE_FLUSH, params); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isSpeaking, setOnUtteranceCompletedListener, setPitch, setSpeechRate, speak
305:	return tts.isSpeaking(); 
-
315:	if (tts.setPitch(getPitch()) == TextToSpeech.ERROR) { 
-
318:	if (tts.setSpeechRate(getRate()) == TextToSpeech.ERROR) { 
-
322:	tts.setOnUtteranceCompletedListener(this); 
-
328:	tts.speak(text, TextToSpeech.QUEUE_FLUSH, options); 
-
347:	tts.stop(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLanguage, setSpeechRate, speak
43:	this.tts = new TextToSpeech(context, this); 
-
50:	tts.setLanguage(Locale.US); 
51:	tts.setSpeechRate(4); 
52:	tts.speak("", TextToSpeech.QUEUE_FLUSH, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: shutdown, stop
80:	mTts.stop(); 
81:	mTts.shutdown(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setLanguage, setOnUtteranceCompletedListener, setSpeechRate, speak
63:	mTts.setOnUtteranceCompletedListener(this); 
64:	mTts.setLanguage(Locale.US); 
65:	mTts.setSpeechRate(0.8f); 
66:	mTts.speak(mFact, TextToSpeech.QUEUE_FLUSH, callbackArgs); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: speak
205:	tts.speak(movementText, 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: areDefaultsEnforced, getDefaultEngine, getLanguage, shutdown
457:	TextToSpeech mTts = new TextToSpeech(ct, null); 
-
460:	results.put("TTS defaults enforced", String.valueOf(mTts.areDefaultsEnforced())); 
461:	results.put("TTS default engine", mTts.getDefaultEngine()); 
462:	Locale tmpLocale = mTts.getLanguage(); 
-
467:	mTts.shutdown(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isLanguageAvailable, setLanguage, setOnUtteranceCompletedListener, setPitch
128:	tts.setPitch(0.5f); 
129:	switch (tts.isLanguageAvailable(locale)) 
-
135:	tts.setLanguage(locale); 
-
156:	int listenerResult = tts.setOnUtteranceCompletedListener(this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: setLanguage
84:	int supported = mTextToSpeech.setLanguage(Locale.US); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: shutdown, stop
126:	mTts.stop(); 
127:	mTts.shutdown(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods:
54:	tts = new TextToSpeech(context, this); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: getDefaultEngine
52:	tts = new TextToSpeech(context, (OnInitListener) this); 
53:	BigLog.e(tag, tts.getDefaultEngine(), '1'); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: shutdown, stop
146:	mTts.stop(); 
147:	mTts.shutdown(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: isLanguageAvailable, setLanguage, setSpeechRate
92:	if(this.textToSpeech.isLanguageAvailable(locale) >= TextToSpeech.LANG_AVAILABLE) { 
93:	this.textToSpeech.setLanguage(locale); 
94:	this.textToSpeech.setSpeechRate( (float) 0.8); 
Full Snippet Info
5
CodeRank
Related Android TextToSpeech Questions & Answers:
Other Android TextToSpeech Examples
14:		/** Called when the activity is first created. */
15:	
16:		private TextToSpeech tts;
17:		private Button btnSpeak;
18:		private EditText txtText;
-
23:			setContentView(R.layout.main);
24:	
25:			tts = new TextToSpeech(this, this);
26:	
27:			btnSpeak = (Button) findViewById(R.id.btnSpeak);

Read More

See Code Examples for Android TextToSpeech Methods: