Integrating Watson Text to Speech into an Android Native App

This blog post helps you in integrating Watson Text-to-Speech(TTS) into your existing Android native mobile app.

Watson Text to Speech

It was a dream come true when I made my first Watbot commit to Github. Watbot is an Android chatbot built using Watson Conversation Service. “The app was developed for a Hands-on lab in a college.”. Students were able to build a bot in less than 30 minutes – from creation of service on Bluemix to running the app on an emulator or a physical device, So I thought of making this more interesting by integrating other Watson services into the app.

One such service which goes hand in hand is Watson Text-to-Speech. Rather than reading a message its always good to hear it.

Text to Speech converts written text into natural sounding audio in a variety of languages and voices. You can customize and control the pronunciation of specific words to deliver a seamless voice interaction that catered s to your audience. Use text to speech to develop interactive toys for children, automate call center interactions, and communicate directions hands-free.

Hear the message in different voices

  • Create a Watson Text to Speech(TTS) service on Bluemix.
  • Navigate to Service Credentials tab and click on “View Credentials”.

Retrieves a list of all voices available for use with the service. The information includes the voice’s name, language, and gender, among other things. To see information about a specific voice, use the Get a voice method.


Refer API Reference on Watson Developer Cloud for other TTS API calls.

How to integrate TTS into my Android native App?

The required gradle entries for TTS is already included in the build.gradle(app) file

In your file, add the below lines of code and replace the username and password placeholders with the TTS service credentials

Also, add the below code which on tap(click) of a message will convert the text into speech

  • Build and Run your app.

Now when you TAP on any message, the text will be heard via a Voice (Voice.EN_LISA). You can change the voice formats in the code.
Check this video to see Watson Text-to-Speech in action,

WatBot – A Voice-enabled Android Chatbot from Vidyasagar MSC on Vimeo.

Note: If you are seeing errors and want to check the complete code,

and check lines 105-134 of

The journey doesn’t stop hear. Let’s complete the flow by adding Watson Speech-to-Text (STT) in the next blog post.

Stay Tuned!!

Polyglot & Pragmatic Programmer • Developer Advocate, IBM Cloud • Intel software Innovator • DZone MVB
(Visited 455 times, 1 visits today)

You may also like...

Show Buttons
Hide Buttons