Explore Text to Speech Using IBM Watson®
Use IBM Watson® Text to Speech to generate digital voice
output
Select the Next arrow to continue.
Task 1: Authenticate your service instance
Select the Next arrow to continue.
1. Consider you have already provisioned for the IBM Watson® Text to Speech service in IBM
Cloud. You must authenticate it now.
Select the Navigation Menu button on the IBM Cloud Dashboard.
2. From the displayed list, select Resource list.
3. On the Resource list page, select the drop-down arrow for the AI / Machine Learning option.
4. Select the Text to Speech service from the displayed list.
5. On the Text to Speech page, select Show credentials in the Credentials box.
6. Copy the API key value in the provided notepad.
Then, press Enter.
Notepad:
SF3_-fVxgpZtpGzflbGxqhOjPQXBzd7TtIduhB0x7e1B
7. Copy the URL value in the provided notepad.
Then, press Enter.
Notepad:
https://api.us-south.text-to-speech.watson.cloud.ibm.com/instances/683ac715-9c3f-
47e0-a726-fbbecb2cedba
8. You have successfully copied the API key and URL values in the notepad.
Select the Next arrow to continue.
Answer the question
What is an API key?
A unique code that gives access to use certain features or services in an app or website
A reusable code to access a service in an app or website
A link that hosts the text to speech service
A link that allows data exchange between a device and a server
1
Explore Text to Speech Using IBM Watson®
Task 2: Add the CURL command
For the next task, you need to add the CURL command to the notepad, make the required changes, and
generate the digital voice output.
Select the Next arrow to continue.
9. Select Getting started.
10. On the Getting started with text to speech page, you need to scroll down to the Synthesize
text in US English section. This screenshot already shows the section. Copy the standard CURL
command and paste it into the provided notepad.
Then, press Enter.
Notepad:
curl -X POST -u "apikey:{apikey}"
--header "Content-Type: application/json"
--header "Accept: audio/wav"
--data "{\"text\":\"hello world\"}"
--output hello_world.wav
"{url}/v1/synthesize?voice=en-US_MichaelV3Voice"
11. You have successfully copied the API key, URL, and CURL command values so far. You now need
to validate your Text to Speech instance in IBM Watson® using these values.
Select the Next arrow to continue.
12. Copy the API key value and paste it into the CURL command.
Then, press Enter.
13. Now, copy the URL value and paste it into the CURL command.
Then, press Enter.
Answer the question
You have successfully copied the API key and URL values in the CURL command.
IBM Watson® Text to Speech allows you to rename the digital voice output file beforehand. Select the
line in the CURL command that must be updated to change the file name.
2
Explore Text to Speech Using IBM Watson®
14. Now that you know how to change the voice, copy the voice key provided in the notepad and
replace the default voice in the CURL command.
Then, press Enter.
Notepad:
en-US_LisaExpressive
15. Next, define the file name for the digital voice output. Copy the file name provided in the
notepad into the CURL command.
Then, press Enter.
Notepad:
FAQ_Return
16. You are now ready to generate the audio for the text. Copy the text provided in the notepad and
replace the default text “hello world” in the CURL command with it.
Then, press Enter.
Notepad:
Customers can return their order within 7 days of the order delivery.
17. Next, you need to copy the complete CURL command and paste it into a new Command
Prompt.
Then, press Enter.
Notepad:
curl -X POST -u "apikey:SF3_-fVxgpZtpGzflbGxqhOjPQXBzd7TtIduhB0x7e1B" --header
"Content-Type: application/json" --header "Accept: audio/wav" --data
"{\"text\":\"Customers can return their order within 7 days of the order delivery.\"}" --
output FAQ_return.wav https://api.us-south.text-to-
speech.watson.cloud.ibm.com/instances/683ac715-9c3f-47e0-a726-
fbbecb2cedba/v1/synthesize?voice=en-US_LisaExpressive
18. The Command Prompt page shows the processed code. The code indicates the location of the
generated digital voice output on the computer's local drive, generally the C drive.
Select the Next arrow to continue.
Conclusion
You have successfully generated digital voice output using IBM Watson® Text to Speech.