Android TextToSpeech Example

TextToSpeech class is responsible to convert text into speech. It provides a lot of methods to control the speech such as setSpeedRate(), setPitch() etc.

In this example, we are going to see the android texttospeech example with speed and pitch option.

activity_main.xml

Drag 2 textviews, 1 edittext, 1 spinner and 1 button for the layout. Now the activity_main.xml file will look like this:

File: activity_main.xml

Activity class

Let's see the code to speak the given text.

File: MainActivity.java


You need to run it on the Real Device (e.g. Mobile) to test the application.







Contact US

Email:[email protected]

TextToSpeech2
10/30