Code example for TextToSpeech

Methods: setPitch, setSpeechRate, speak

0
            	//SoundPool sp = new SoundPool(1, AudioManager.STREAM_MUSIC, 0); 
            	//sp.setVolume(AudioManager.STREAM_MUSIC, 1, 0); 
            	HashMap<String, String> hm = new HashMap<String, String>();
            	hm.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_SYSTEM));
            	hm.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, "stuff");
            	mTts.setPitch(1);
            	mTts.setSpeechRate(1);
            	AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
            	am.setStreamVolume(AudioManager.STREAM_SYSTEM, SeekBar1.getProgress(), AudioManager.FLAG_VIBRATE);
            	mTts.speak(EditText1.getText().toString(), TextToSpeech.QUEUE_FLUSH, hm);
            } 
        }); 
    } 
     
    @Override 
    public void onDestroy() { 
        if (mTts != null) {
            mTts.stop();
            mTts.shutdown();
        } 
        super.onDestroy();