[51CTO.com Quick Translation] Compared to reading the content of the message, it is undoubtedly more convenient to listen to the content directly. Integrating Watson's text-to-speech function into existing Android native applications can help everyone easily achieve this goal. In today’s article, we will explore how to integrate Watson text-to-speech (TTS) functionality into existing Android native mobile applications. The first time I tried to submit my own Watbot to GitHub, the experience was simply "dreamlike". Watbot is an Android chatbot built using Watson conversational services. It mainly helps college students learn how to create services on Bluemix and run applications through simulators or physical devices in 30 minutes to achieve learning goals. However, in my opinion, it is obviously more interesting to integrate other Watson services into the application, especially Watson text-to-speech services. Compared with reading the content of the message, it is undoubtedly more convenient to directly listen to its content. “Text-to-speech converts written text into natural-sounding audio. You can customize and control the pronunciation of specific words, providing your audience with seamless voice interactions for interactive toys for children, automated call center interactions, and hands-free navigation systems.” Hear messages in different voices
The above delegate is used to retrieve a list of all voices available for the service. Information provided includes the voice name, language, gender, etc. To get information about a specific voice, use the "Get a voice" method:
Interested friends can click here to refer to the API reference on Watson Developer Cloud to learn more about TTS API calls. How do I integrate TTS into my Android native app? This requires us to add the TTS Gradle entry to our build.gradle (app) file:
Add the following code to your MainActivity.java file and replace the username and password placeholders with your actual TTS service credentials. In addition, after adding the following code, tap a message to convert text to speech: Next, build and run your app. Now whenever you tap on a message, the text will be played back through the Voice (Voice.EN_LISA). You can also change the voice format in the code. Note: If you find an error and want to check the full code, use the following command: Then check lines 105 to 134 of MainActivity.java. Of course, this journey is far from over. In subsequent articles, we will continue to introduce the integration methods and effects of Watson Speech-to-Text (STT) service. Stay tuned! Original title: Integrating Watson Text-to-Speech Into an Android Native App Original author: Vidyasagar Machupalli [Translated by 51CTO. Please indicate the original translator and source as 51CTO.com when reprinting on partner sites] |
<<: Young man, it’s time to create your first cool 3D effect!
>>: iOS vs Android Development — How Do We Choose?
Course Catalog: ├──01 Sumansoul Level 2 Enhanced ...
Weibo may not bring direct sales, but it can subt...
What Apple never expected was that after its own ...
The article is short and only contains essential ...
This article was reviewed by: Xiaobo Zhou, Doctor...
What is "Mom's Hand"? The medical t...
How to make a card-point video with a mobile phon...
The dugong, known as the "mermaid", is ...
There was an article that went viral this morning...
Operators will come into contact with paid promot...
There are many methods of data analysis . Today w...
From the moment you decide to do Google foreign t...
This article provides you with a guide to buildin...
If your app has been launched and follows the fol...
How much is the quotation for Zhangjiajie Driving...