🚧

v1.0.0-beta

We are currently in beta. During our beta release, Real-Time streaming will not be available.

If you're working with live audio streams, you can stream your audio data in real-time to our secure WebSocket API found at https://api.voice.virlow.com. We will stream transcripts back to you within a few hundred milliseconds and, additionally, revise these transcripts with more accuracy over time as more context arrives.

WebSocket client

We use Socket.io to enable low-latency, bidirectional and event-based communication between a client and a server. For this, you will need use a supported Socket.io packages from list below:

Open Source Example Code

Getting Started

To connect with the real-time endpoint, you must use a WebSocket client listed above and establish a connection with https://api.voice.virlow.com

1. Authenticate

Authentication is handled using an API KEY in the query parameter. You can review the Authentication section in the docs to learn how to create an API Key.

const socketio = io("https://api.voice.virlow.com?x-api-key=YOUR_API_KEY&sample-rate=YOUR_SAMPLE_RATE", {
    forceNew: true,
  	transports: ['polling']
});

2. Establish a Connection

Once your request is authorized, you will need to establish a connection. Each new connection is assigned a random 20-characters identifier. This identifier is synced with the value on the server-side.

// Establish a new connection
socket = socketio.on('connect', function () {
  console.log('Socket connected to speech server');
  console.log(socket.id);
});

socket.connect();

3. Start Streaming

Once your request is authorized and connection established, you can the audio data to the server.

You need to set the sampleRateHertz of your audio data in the query parameter of the request, if you don't include the sampleRateHertz it will default to 16000.

As of v1.0.0 our API server only accepts a sampleRateHertz of 16000,. We are planning on our v1.0.1 launch to include the ability to include a sampleRateHertz as a query parameter. For this you will need to resample an audio buffer. We have provided a Javascript resampler.js for your reference.

// Use a worker thread to resample the audio
recorder.onaudioprocess = function (audioProcessingEvent) {
  let inputBuffer = audioProcessingEvent.inputBuffer;
  worker.postMessage({
    command: 'convert',
    // We only need the first channel
    buffer: inputBuffer.getChannelData(0)
  });
  worker.onmessage = function (msg) {
    if (msg.data.command == 'newBuffer') {
      socket.emit('audio_in', msg.data.resampled.buffer);
    }
  };
};

4. Retrieve the Interim Results

4. Retrieve the Final Results