Android TextToSpeech TutorialIn android, you can convert your text into speech by the help of TextToSpeech class. After completion of the conversion, you can playback or create the sound file. Constructor of TextToSpeech class
Methods of TextToSpeech classThe commonly used methods of TextToSpeech class are as follows:
TextToSpeech.OnInitListener InterfaceYou need to implement TextToSpeech.OnInitListener interface, for performing event handling on TextToSpeech engine. Method of TextToSpeech.OnInitListener InterfaceThere is only one method in this interface.
Android TextToSpeech ExampleLet's write the code to convert text into voice. activity_main.xmlDrag one textview, one edittext and one button for the layout. Now the activity_main.xml file will look like this: File: activity_main.xml
Activity classLet'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.Next: TextToSpeech example with speed and pitch optionTextToSpeech example with speed and pitch option
Next TopicAndroid TextToSpeech Example
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week