Java Code Examples for android.speech.tts.TextToSpeech#setPitch()
The following examples show how to use
android.speech.tts.TextToSpeech#setPitch() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Speech.java From 10000sentences with Apache License 2.0 | 6 votes |
public Speech(Context context, Language language) { this.context = context; this.locale = findLocale(language); this.languageFound = locale != null; this.enabled = Preferences.isUseTTS(context); if (!this.enabled) { return; } tts = new TextToSpeech(context, new TextToSpeech.OnInitListener() { @Override public void onInit(int i) { Speech.this.initialized = true; } }); tts.setPitch(1); tts.setSpeechRate(0.75F); tts.setLanguage(locale); }
Example 2
Source File: MainActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 5 votes |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == TTS_DATA_CHECK) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() { public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { ttsIsInit = true; if (tts.isLanguageAvailable(Locale.UK) >= 0) tts.setLanguage(Locale.UK); tts.setPitch(0.8f); tts.setSpeechRate(1.1f); speak(); } } }); } else { Intent installVoice = new Intent(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installVoice); } } // Listing 14-3: Finding the results of a speech recognition request if (requestCode == VOICE_RECOGNITION && resultCode == RESULT_OK) { ArrayList<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); float[] confidence = data.getFloatArrayExtra(RecognizerIntent.EXTRA_CONFIDENCE_SCORES); // TODO Do something with the recognized voice strings } }
Example 3
Source File: TtsSpeaker.java From sample-tensorflow-imageclassifier with Apache License 2.0 | 5 votes |
@Override public void speak(TextToSpeech tts) { tts.setPitch(1.5f); tts.setSpeechRate(1.5f); super.speak(tts); tts.setPitch(1f); tts.setSpeechRate(1f); }
Example 4
Source File: TtsSpeaker.java From sample-tensorflow-imageclassifier with Apache License 2.0 | 5 votes |
@Override public void speak(TextToSpeech tts) { tts.setPitch(0.2f); tts.speak("I see dead people...", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); tts.setPitch(1); tts.speak("Just kidding...", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); }
Example 5
Source File: TtsSpeaker.java From sample-tensorflow-imageclassifier with Apache License 2.0 | 5 votes |
@Override public void speak(TextToSpeech tts) { tts.setPitch(1.8f); tts.setSpeechRate(1.4f); tts.speak("It's a bird! It's a plane! It's superman", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); tts.setPitch(1); tts.setSpeechRate(1f); tts.speak("Just kidding...", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); }
Example 6
Source File: TtsSpeaker.java From sample-tensorflow-imageclassifier with Apache License 2.0 | 5 votes |
@Override public void speak(TextToSpeech tts) { tts.setPitch(1.3f); tts.setSpeechRate(1.6f); tts.speak("Hey, that looks like me!", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); tts.setPitch(1); tts.setSpeechRate(1f); tts.speak("Just kidding...", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); }
Example 7
Source File: TtsSpeaker.java From sample-tensorflow-imageclassifier with Apache License 2.0 | 5 votes |
@Override public void speak(TextToSpeech tts) { tts.setPitch(0.7f); tts.setSpeechRate(1.6f); tts.speak("Oops, someone left the lens cap on!", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); tts.setPitch(1); tts.setSpeechRate(1f); tts.speak("Just kidding...", TextToSpeech.QUEUE_ADD, null, UTTERANCE_ID); }
Example 8
Source File: VoiceHelper.java From AlexaAndroid with GNU General Public License v2.0 | 5 votes |
/** * Initalize our TextToSpeech engine, use a few tricks to get it to use a smaller file size * and be more easily recognized by the Alexa parser * @param context local/application level context */ private VoiceHelper(Context context){ mContext = context.getApplicationContext(); mTextToSpeech = new TextToSpeech(mContext, mInitListener); mTextToSpeech.setPitch(.8f); mTextToSpeech.setSpeechRate(1.3f); mTextToSpeech.setOnUtteranceProgressListener(mUtteranceProgressListener); }