This guide will walk you through how to transcribe pre-recorded audio with the Reverie API. We provide two scenarios to try: transcribe a remote file and transcribe a local file.

Before you start, you’ll need to follow the steps in the Get your API Credentials to obtain your API key.

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.

Step 1 : Upload the Audio File

Request : Transcribing Audio

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'src_lang: hi' \
--header 'domain: generic' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APPNAME: stt_file' \
--header 'REV-APP-ID: <YOUR API-ID>' \
--form 'audio_file=@"<File Path>"

Request: Transcribing Audio other than Default Format

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'src_lang: hi' \
--header 'domain: generic' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APPNAME: stt_file' \
--header 'REV-APP-ID: <YOUR API-ID>' \
--header 'format: mp3'
--form 'audio_file=@"<File Path>"'

Response: Success

{
    "id": "ddf4ebda44af4fdf95118af9a6f14d46fce12ed85347471d",
    "success": true,
    "final": true,
    "text": "नाइनटी एट पॉइंट थ्री एफएम पर प्ले करिए",
    "cause": "EOF received",
    "confidence": 0.891,
    "display_text": "98.3 एफएम पर प्ले करिए"
}

Response: Error Message

{
    "id": "03e4f260551345e6832bf62ba273e0096fd303e72f94453f",
    "success": false,
    "text": "",
    "final": true,
    "confidence": 1.0,
    "cause": "no file given",
    "display_text": ""  }

API References

HTTP Request URL

URL ElementsSample URL
https://(hostname)https://revapi.reverieinc.com/

Headers

REV-API-KEY
string
required

API key shared by the Reverie team

REV-APP-ID
string
required

APP ID shared by the Reverie team

REV-APPNAME
string
required

Value if this string should always be stt_file

src_lang
string
required
  • Specify the language code.
  • Example: hi
  • Refer to section Language Codes for valid language code.
domain
string
required
  • This field identifies your use case type and set of the terminology defined for transcription.
  • e.g. for general audio is ‘generic’
  • It is only required for the first API i.e Upload File API.
format
string
  • Mention the audio sample rate and file format of the uploaded file.
  • Refer to section Supported Audio Formats for valid audio format code.
  • It is only required for the first API i.e Upload File API
  • Note:
    • By default, the format = 16k_int16. (WAV, Signed 16 bit, 16,000 or 16K Hz).
    • It is an optional parameter.

Query Parameter

audio_file
file
required
  • An audio file for which the transcript is desired.

Response

id
string
  • A unique Identity number auto-assigned by the API for each request, to be used to fetch job status and transcripts.
success
boolean
  • Provides true or false based on the nature of the response returned by the API.
final
boolean
  • Provides whether the response is the final response returned by the API.
text
string
  • Provides the trascripted response returned by the API for the audio file.
cause
string
  • Reason for obtaining the final output, generally due to End Of File (EOF) received.
confidence
float
  • Provides the confidence on the scale of 0 - 1 for the output.
display_text
string
  • Provides the display text for the final output based on some post processing.

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 Speech-to-Text request.

Install Dependencies

npm i @reverieit/reverie-client

Transcribe Audio from an Audio File

To automatically transcribe pre-recorded audio using Reverie’s SDK, follow these steps

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

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

const response = await reverieClient.transcribeAudio({
audioFile: file,
language: lang,
});

console.log("Response from API:", response);

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

{
    "id": "ddf4ebda44af4fdf95118af9a6f14d46fce12ed85347471d",
    "success": true,
    "final": true,
    "text": "नाइनटी एट पॉइंट थ्री एफएम पर प्ले करिए",
    "cause": "EOF received",
    "confidence": 0.891,
    "display_text": "98.3 एफएम पर प्ले करिए"
}

In this response we see:

  • id : A unique Identity number auto-assigned by the API for each request.
  • success : Provides a message code which can be used to look up the nature of the response returned by the API.
  • final :Provides a brief description about the response returned by the API.
  • text : An array of transcript objects including, channel_number, transcript, list of words with start time, end time and confidence.Please check the sample response.
  • cause : An array of transcript objects including, channel_number, transcript, list of words with start time, end time and confidence.Please check the sample response.
  • confidence : An array of transcript objects including, channel_number, transcript, list of words with start time, end time and confidence.Please check the sample response.
  • display_text : An array of transcript objects including, channel_number, transcript, list of words with start time, end time and confidence.Please check the sample response.