[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?
Chinese people have an indissoluble bond with juj...
Recently, the topic #Grandma used rat oil to trea...
Apple is working on an ambient light sensor that ...
In 2014, China's television manufacturing indu...
Generally, migrant workers working in factories o...
During the summer vacation, major tourist attract...
Friends who work in operations or marketing will ...
[[413279]] App splash screen ads are nothing new....
In recent weeks, tech news headlines have been fi...
Novels have become an indispensable part of our li...
Recently, Lanxiang has been played to pieces. The...
Just after this year's Spring Festival holida...
WeChat may be the most frequently used app in eve...
"Everyone says that the redness of my T-zone...
Cross-border e-commerce is a branch of the e-comm...