[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?
March 13 news, according to Electrek, in recent w...
I recently saw a set of data published in the &qu...
SpringCloud Alibaba Practical 2021 Resource Intro...
Dark matter vs. gravity: Einstein is always right...
For educational institutions, there are relativel...
The Mid-Autumn Festival is coming, and mooncakes ...
Dogs are humans’ best friends and companions , an...
In recent years, traditional Chinese style and tr...
Review expert: Wang Xuejiang, professor at Capita...
There is a large cat species on the African grass...
King of Chicken CF rental project, stable dozens ...
"I will be 27 after this birthday. I will ch...
When buying a mobile phone worth several thousand...
The Mengtian laboratory module took off from the ...
Many netizens have already used SSD and upgraded W...