Web Library#

Soniox Web Voice is a Javascript client library that enables you to integrate with Soniox API service directly from your web application. In just a few lines of code, you can do real-time and low-latency automatic speech recognition with various configurations. See a complete example below.

For complete documentation of the Soniox Web Voice library, see the Web Library API Reference.

Source code of the library is available in the Soniox Web Voice GitHub repository.


This example demonstrates how to do live transcription from a microphone using Soniox Web Voice library in a webpage or a web application. It contains a simple user interface to start, stop or cancel live transcriptions from the microphone.

To try it out, download the example.html file, set your API key in example.html and open example.html in your browser.


1. Include Javascript package#

Include Soniox Web Voice Javascript package in your HTML page. The package includes functionality for capturing audio from your microphone and communication with Soniox API service.

<script src="https://js.soniox.com/soniox-web-voice.js"></script>

Always load soniox-web-voice.js from https://js.soniox.com. You should not include it in a bundle or self-host it.

2. Transcribe#

The code creates the RecordTranscribe object, which simultaneously captures audio from your microphone and transcribes it using Soniox speech recognition service. The result of the transcription is returned to a callback function in the example, which simply prints recognized words into the developer console.

Make sure to set your API key, which you can find under API Keys tab for a given project in Soniox Console.


// Set your API key.
let apikey = "<YOUR-API-KEY>";

// Create RecordTranscribe object.
let recordTranscribe = new sonioxWebVoice.RecordTranscribe()

// Set event handler.

function printWords(result) {
    for (let i = 0; i < result.words.length; ++i) {

// Start transcribing from your microphone.