Build an Android text to speech app in under 10 minutes

Share this post:

text to speech app logo This post describes how you can add Watson’s cognitive service to an Android app in under 10 minutes. The voice user interface is a great way to enhance the user interface of IoT devices, robots, or a voice-controlled vehicle. IBM Watson Text-To-Speech service is available from the IBM Bluemix catalog.

Note: If you haven’t done so already, please skim my prior post “Connect native Android app to Watson Sentiment Analysis in under 10 minutes” since it covers steps in more detail than in this post.


Overview of steps

Below is an overview of the steps:

  1. Create a typical Android application in Java
  2. Add the Watson lib: Watson-Developer-Cloud SDK for Java
  3. Instantiate the Bluemix Watson service and get the key token to it
  4. Add some code in your Android app to invoke the cognitive service
  5. Quick test of the app.

You’ll build a simple application with a submit button, an editable text field, and an output field. The video below shows the steps:

The results from the emulator:

text to voice app development

Run the test to see if the fields work as planned and you see the debug println in the console as well as in the ViewText field.

The entire code for the UI is shown below:

The following video covers the steps for connecting the UI with the Watson Text to Speech service:

Below is the code from the video:

And a quick screenshot of the editor upon completion:

text to speech android application

The section of code invoking the Text to Speed service is excerpted below for easy reference:

 TextToSpeech textToSpeech = initTextToSpeechService();
streamPlayer = new StreamPlayer();

That’s it! You are ready to run and hear the voice of IBM Watson!

Please follow me on Twitter: @blumareks, and check my blog on

More How-tos stories
April 23, 2019

Announcing the Deprecation of the Watson Machine Learning JSON Token Authentication Service

We’d like to inform you about the deprecation of the Watson Machine Learning JSON Token Authentication service. This method of authentication will be retired on May 30, 2019.

Continue reading

April 2, 2019

Data Refinery and Profiling Changes in Watson Studio and Watson Knowledge Catalog

We'd like to announce data refinery and profiling changes related to Watson Studio and Watson Knowledge Catalog that will take effect on May 17, 2019.

Continue reading

March 26, 2019

Announcement for the IBM Watson Discovery Community

Starting April 2, 2019, we will be upgrading the infrastructure of the IBM Watson Discovery service to improve reliability and quality of results.

Continue reading