Oct 08, 2019 To use Google Text-to-speech on your Android device, go to Settings Language & Input Text-to-speech output. Select Google Text-to-speech Engine as your preferred engine. Note, on many Android devices, Google Text-to-speech is already turned. Oct 05, 2019 In those situations, you can make good use of text to speech apps to listen to text files, ebooks, and web pages instead of reading. Here are some of the best text to speech apps for Android. If mentioned otherwise, most of TTS apps on Android uses the built-in Google Text-to-Speech engine. In general, most Android devices have Google Text to. Download samsung text-to-speech engine android, samsung text-to-speech engine android, samsung text-to-speech engine android download free.
- Android Basics
- Android - User Interface
- Android Advanced Concepts
- Android Useful Examples
- Android Useful Resources
- Selected Reading
Android allows you convert your text into voice. Not only you can convert it but it also allows you to speak text in variety of different languages.
Android provides TextToSpeech class for this purpose. In order to use this class, you need to instantiate an object of this class and also specify the initListener. Its syntax is given below −
In this listener, you have to specify the properties for TextToSpeech object , such as its language ,pitch e.t.c. Language can be set by calling setLanguage() method. Its syntax is given below −
The method setLanguage takes an Locale object as parameter. The list of some of the locales available are given below −
Sr.No | Locale |
---|---|
1 | US |
2 | CANADA_FRENCH |
3 | GERMANY |
4 | ITALY |
5 | JAPAN |
6 | CHINA |
Once you have set the language, you can call speak method of the class to speak the text. Its syntax is given below −
Apart from the speak method, there are some other methods available in the TextToSpeech class. They are listed below −
Sr.No | Method & description |
---|---|
1 | addSpeech(String text, String filename) This method adds a mapping between a string of text and a sound file. |
2 | getLanguage() This method returns a Locale instance describing the language. |
3 | isSpeaking() This method checks whether the TextToSpeech engine is busy speaking. |
4 | setPitch(float pitch) This method sets the speech pitch for the TextToSpeech engine. |
5 | setSpeechRate(float speechRate) This method sets the speech rate. |
6 | shutdown() This method releases the resources used by the TextToSpeech engine. |
7 | stop() This method stop the speak. |
Example
The below example demonstrates the use of TextToSpeech class. It crates a basic application that allows you to set write text and speak it.
To experiment with this example , you need to run this on an actual device.
Steps | Description |
---|---|
1 | You will use Android studio to create an Android application under a package com.example.sairamkrishna.myapplication. |
2 | Modify src/MainActivity.java file to add TextToSpeech code. |
3 | Modify layout XML file res/layout/activity_main.xml add any GUI component if required. |
4 | Run the application and choose a running android device and install the application on it and verify the results. |
Here is the content of src/MainActivity.java.
Download Text To Speech Engine For Android Free
Here is the content of activity_main.xml
In the following code abcindicates the logo of tutorialspoint.com
Google Text To Speech Online
Here is the content of Strings.xml.
Here is the content of AndroidManifest.xml
Let's try to run your application. I assume you have connected your actual Android Mobile device with your computer. To run the app from Android studio, open one of your project's activity files and click Run icon from the toolbar. Before starting your application, android studio will display following window to select an option where you want to run your Android application.
Select your mobile device as an option and then check your mobile device which will display following screen.
Now just type some text in the field and click on the text to speech button below. A notification would appear and text will be spoken. It is shown in the image below −
Now type something else and repeat the step again with different locale. You will again hear sound. This is shown below −