Azure Text To Speech with Postman
Nuduja Mapa
Posted on August 4, 2022
Prerequisites
Azure subscription - Create one for free
Create a Speech resource in the Azure portal.
Get the resource key and region. After your Speech resource is deployed, select Go to resource to view and manage keys. For more information about Cognitive Services resources, see Get the keys for your resource.
Azure Text To Speech Function in the Azure Portal
The status of the created resource can be checked by navigating to the overview tab
The keys and the endpoints of the resource can be found by navigating to "Keys and Endpoints" under the Resource Management Tab.
That covers the Azure Text to speech configuration in the Azure Portal.
Configuring Postman
Set the Endpoint URL as the Request URL
Set the Request URL Type to Post
In the Header section,
- Set the key as "Ocp-Apim-Subscription-Key" and the first key as its value.
- Set the key as "Content-type" and its key as "application/ssml+xml"
- Set the key as "X-Microsoft-OutputFormat" and its key as the desired type of audio file format and quality.
4.In the Body section, configure it to raw XML and copy the following code,
<speak version='1.0' xml:lang='en-US'><voice xml:lang='en-US' xml:gender='Female'
name='en-US-JennyNeural'>
Hello, I am trying Azure Text To Speech
</voice></speak>
5.Then click on the Send button to send the request.
6.To save the audio file received as the response. Click on "Save Response" and then select "save to file". Select the desired location in the "Select path to save file" dialog box and click on "Save"
Simply add the text you need to be narrated in the given code. The Languages can be changed as provided by Azure Cognitive Services.
Posted on August 4, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.