DEV Community

Nuduja Mapa
Nuduja Mapa

Posted on

Azure Text To Speech with Postman

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

Resource Overview

The keys and the endpoints of the resource can be found by navigating to "Keys and Endpoints" under the Resource Management Tab.

Key and Endpoints

That covers the Azure Text to speech configuration in the Azure Portal.

Configuring Postman

  1. Set the Endpoint URL as the Request URL

  2. Set the Request URL Type to Post

  3. 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.

Example of the filled Header section

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>
Enter fullscreen mode Exit fullscreen mode

Example Filled Body Section

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"

Save response

Save to file

Simply add the text you need to be narrated in the given code. The Languages can be changed as provided by Azure Cognitive Services.

Top comments (0)