[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?
Produced by: Science Popularization China Author:...
In modern life, whether it is food, medicine, dai...
Not long ago, a netizen uploaded a video of "...
1. Fuyao Glass's annual report shows that the...
Recently, the information of the Ministry of Indu...
There is no standardized perfect solution for mar...
In the hot summer, the temptation of delicious fo...
Wearable devices are a very trendy thing at prese...
Where can I drink and taste tea in Changsha? 185-...
Mixed Knowledge Specially designed to cure confus...
When you walk on the street, do you always feel l...
Learn React in a simple and easy way, and master t...
People in the Internet industry like to talk abou...
Fear, excitement, novelty and confusion - what ki...
Reviewer: Yang Yuqiu Professor of Textile Materia...