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.

Include the SDK

To use Reverie’s Speech-to-Text Streaming SDK, include the following CDN in your project:

<!-- If you are using STT stream, add the following script to the head section of your index.html -->
<script src="https://cdn.jsdelivr.net/npm/reverie-stt-sdk/dist/bundle.js"></script>

Install Dependencies

npm i @reverieit/reverie-client

Transcribe Audio from a Remote Stream

The following code shows how to transcribe audio from a remote audio stream like a microphone

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

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

await reverieClient.init_stt({
src_lang: "hi",
callback: (event) => {
console.log("STT event:", event);
},
element: document.getElementById("transcript"),
domain: "generic"

});

// Start/Stop streaming
await reverieClient.start_stt();
await reverieClient.stop_stt();

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": "bb261bd789af4ba487a2667f8d942d4d7e0195fd1c8e4073",
  "success": true,
  "text": "आत्म निर्भर योजना इस योजना अथवा अभियान का उद्देश्य एक सौ तीस करोड़ भारतवासियों को आत्मनिर्भर बनाना है ताकि देश का हर नागरिक संकट की इस घड़ी में कदम से कदम मिलाकर चल सके",
  "display_text": "आत्म निर्भर योजना इस योजना अथवा अभियान का उद्देश्य 130 करोड़ भारतवासियों को आत्मनिर्भर बनाना है ताकि देश का हर नागरिक संकट की इस घड़ी में कदम से कदम मिलाकर चल सके",
  "final": true,
  "confidence": 0.743304,
  "cause": "EOF received"
}

In this response we see:

  • id : API will auto-assign assign a unique identification number for each request.
  • success : Will indicate the functional status of the API:
    • If the success = true, then the API is functioning and ready to generate output.
    • If the success = false, then the API is not functional and has some errors
  • final : Will report whether the received output is partial or final:
    • If the final = true, then the received text is the final output.
    • If the final = false, then the text received is partial and is still processing the file.
  • cause : Reason for obtaining the final output.
  • text : The streaming audio input is converted into text format in the requested language.
  • confidence : The level of confidence that Streaming STT API has in the accuracy of the transcription.
  • display_text : The beautified text of the final transcript. If the final transcript consists of digits, URL, app names, it is quickly converted to a readable format for the user.