Setup

The TTS API establishes the connection using the HTTPS protocol. It uses standard HTTP codes, authentication, and verbs. It will allow you to synthesize high-quality spoken audio in multiple formats. You’ll always receive audio data or an error message in the same HTTP transaction.

The REV-APPNAME parameter in the Header will identify the requested API. The API will recognize the default settings like languages, SSML tag settings by the REV-APP-ID, and REV-API-KEY for each customer account.

Note: On receiving your request, the REV-APP-ID and the REV-API-KEY are forwarded to your email ID to test the API.

Authentication

The Localization API will use the App Id and API key to authenticate requests. Your credentials carry many privileges, so be sure to keep them secure.

Use your App Id and API Key by assigning it to REV-APP-ID and REV-API-KEY, respectively.

How Does API work?

The process to generate an audio file for the text input is:

  1. Post the request by:

    • Enter the valid REV-APPNAME, REV-APP-ID, and REV-API-KEY

    • Define the Language Code

    • Enter the text or for which you want to obtain the speech

    • Select the output voice type (either male voice or the female voice) of the audio file.

    • Define the SSML Code, if required

  2. By default, the API will return the WAV audio file with a sampling rate of 22.05KHz.

Code Snippets for Integration

Synthesizing Audio for Single Sentence

Request

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APP-ID: <YOUR APP-ID>' \
--header 'REV-APPNAME: tts' \
--header 'speaker: hi_female' \
--header 'Content-Type: application/json' \
--data-raw '{
	"text": "किसान होंगे आत्मनिर्भर, समृद्ध भारत"
}'

Synthesizing Audio for Multiple Sentences

Request

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APP-ID: <YOUR APP-ID>' \
--header 'REV-APPNAME: tts' \
--header 'speaker: hi_female' \
--header 'Content-Type: application/json' \
--data-raw '{
	"text": ["भारत मेरा देश है।" , "मेरी कंपनी का नाम रेवेरी लैंग्वेज टेक्नोलॉजीज है।" ], 
	"speed": 1,
	"pitch": 0,
	"format": "WAV"

}'

Passing SSML Tag & Synthesizing Audio

Request

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APP-ID: <YOUR APP-ID>' \
--header 'REV-APPNAME: tts' \
--header 'speaker: hi_female' \
--header 'Content-Type: application/json' \
--data-raw '{
	"ssml": "<speak> <voice name=\"en_female\">Hello.</voice> </speak>", 
	"speed": 1,
	"pitch": 0,
	"format": "WAV"
}'

Error Response

{
    "success": false,
    "cause": "no `spkr` given"
}

Last updated