Reverie API Documentation
  • Reverie APIs
  • Reference
    • Localization API
      • Setup
      • API Reference
      • Supported Languages
      • Supported Domains
      • API Messages
    • Transliteration API
      • Setup
      • API Reference
      • Language Codes
      • Supporting Domains
      • API Messages
    • Text to Speech API
      • Setup
      • API Reference
      • SSML (Speech Synthesis Markup Language)
      • Phoneme Reference
      • API Default Behaviour
      • Supporting Speaker Code
      • Supporting Sampling Rate
      • Supporting Audio Format
      • API Messages
    • Speech to Text | Streaming API
      • Setup
      • API Reference
      • Language Codes
      • Supporting Audio Format
      • Supporting Domains
      • API Messages
  • Speech to Text | File API
    • Setup
    • API Reference
    • Language Codes
    • Supporting Audio Format
    • API Messages
  • Speech to Text | Batch API
    • Setup
    • API Reference
    • Language Codes
    • Sample Request Responses
    • Supporting Audio Format
  • Language Identification API
    • Sample Code
    • API Reference
    • Language Codes
  • Reverie Products
    • Swalekh
    • Vachak
Powered by GitBook
On this page
  • Authentication
  • How Does API work?
  • Code Snippets for Integration
  1. Reference
  2. Text to Speech API

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"
}

PreviousText to Speech APINextAPI Reference

Last updated 1 year ago