In this guide, you’ll learn how to automatically transcribe live streaming audio in real time using Reverie’s SDKs, which are supported for use with the Reverie API.

Before you start, you’ll need to follow the steps in the Get your API Credentials to obtain your API KEY & APP ID.

Make your first Call

Make your first API Call using the cURL request. Add your own API Credentials where it says <YOUR-APP-ID> & <YOUR-API-KEY> and then run the following example in a terminal or your favorite API client.

cURL
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": "किसान होंगे आत्मनिर्भर, समृद्ध भारत"
}'

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

The audio file will contain the voice of the selected model saying the words that you sent in your request.

SDKs

Reverie has several SDKs that can make it easier to use the API. Follow these steps to use the SDK of your choice to make a Reverie TTS request.

Install Dependencies

npm i @reverieit/reverie-client

Generate audio from text

The following code shows how to generate Speech from the Text provided .

const ReverieClient = require("reverie-client");

const reverieClient = new ReverieClient({
  apiKey: "YOUR-API-KEY",
  appId: "YOUR-APP-ID",
});

try {
  const audioBlob = await reverieClient.text_to_speech({
    text: text,
    speaker: speaker,
    speed: speed,
    pitch: pitch,
  });

  const audioUrl = URL.createObjectURL(audioBlob);
  console.log("Audio URL is:", audioUrl);
} catch (error) {
  console.error("Error:", error);
}

Results

In order to see the results from Reverie, you must run the application. Run your application from the terminal. Your transcripts will appear in your shell.

# Run your application using the file you created in the previous step
# Example:
npm start

Analyzing the Response

​By default, the Reverie Text-to-Speech (TTS) API returns audio in the WAV format with a sampling rate of 22.05 kHz (22,050 Hz). This sampling rate is commonly used in speech synthesis, offering a balance between audio quality and file size. You may play it to listen to the synthesized speech output and evaluate its clarity, naturalness, and suitability for your application.