/** * Sets the speech pitch for the TextToSpeech engine. * This has no effect on any pre-recorded speech. * * @param pitch Speech pitch. 1.0 is the normal pitch, lower values lower the tone of the * synthesized voice, greater values increase it. * @return speech instance */ public Speech setTextToSpeechPitch(final float pitch) { mTtsPitch = pitch; mTextToSpeech.setPitch(pitch); return this; }
public void setPitch(float pitch) { if (pitch != this.pitch) { this.pitch = pitch; if (isTTSInitialized) { this.tts.setPitch(pitch); if (state == State.PLAYING) { executor.execute(speak); // speak(); } } } }
TextToSpeech mTts; mTts = new TextToSpeech(this, this // TextToSpeech.OnInitListener ); ... mTts.setPitch(2.3); //change it as per your need ... mTts.speak(s,TextToSpeech.QUEUE_FLUSH,null);
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(); } } });
import android.speech.tts.TextToSpeech; import java.util.Locale; public class Test implements TextToSpeech.OnInitListener { TextToSpeech tts; String text; public Test(String text) { tts = new TextToSpeech(MyApplication.getContext(), this); this.text = text; } @Override public void onInit(int i) { if (i == TextToSpeech.SUCCESS) { tts.setLanguage(Locale.GERMAN); tts.setPitch(3); tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); while(tts.isSpeaking()); } } }
private void initTts(final Context context) { if (mTextToSpeech == null) { mTtsProgressListener = new TtsProgressListener(mContext, mTtsCallbacks); mTextToSpeech = new TextToSpeech(context.getApplicationContext(), mTttsInitListener); mTextToSpeech.setOnUtteranceProgressListener(mTtsProgressListener); mTextToSpeech.setLanguage(mLocale); mTextToSpeech.setPitch(mTtsPitch); mTextToSpeech.setSpeechRate(mTtsRate); } }
public void initConfig() { if (tts != null) { tts.setPitch(UIHelper.getFloatFromPreferences(Constants.PREF_TTS_PITCH, 1.0f)); tts.setSpeechRate(UIHelper.getFloatFromPreferences(Constants.PREF_TTS_SPEECH_RATE, 1.0f)); whiteSpaceDelay = UIHelper.getIntFromPreferences(Constants.PREF_TTS_DELAY, 500); } }
mTextToSpeech.setPitch(pitch);
mTts.setPitch(speechPitch); mTts.setSpeechRate(intent.getFloatExtra("rate", 1.0f));
isTTSInitialized = true; tts.setSpeechRate(speed); tts.setPitch(pitch); if (state == State.WANT_TO_PLAY) { playCmd();
tts.setPitch(pitch); } catch (Exception e) { UserError.Log.e(TAG, "Deep TTS problem setting speech rates: " + e);
tts.setPitch(pitch); } catch (Exception e) { UserError.Log.e(TAG, "Deep TTS problem setting speech rates: " + e);