[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?
Entering the Maritime History Museum of the China...
Recently, many people have seen a video: a netize...
In the field of live streaming sales on Douyin, i...
Humans are the smartest creatures on earth, and t...
"Success at the first sign of success",...
Preface: Apple A9 and HiSilicon 950 are not within...
Report highlights Facebook videos have the highes...
Recently, important news came from the 2024 Natio...
With over 100 million monthly active users and 10...
Okay, don’t be heartbroken and don’t scold Guan X...
In daily life, do you prefer to make a cup of hot...
Thousands of sea turtles die every year from bein...
The Olympic Games have just ended. In this Olympi...
In mid-July, I did an online micro-class sharing ...
[[125876]] I copied a sample code from the Intern...