QVAC Logo

transcribeStream( )

Streams audio transcription results in real-time, yielding text chunks as they become available from the model.

function transcribeStream(params): AsyncGenerator<string>;

Yields text chunks as they become available from the model.

Parameters

NameTypeRequired?Description
params.modelIdstringThe identifier of the transcription model
params.audioChunkstring | BufferAudio input as file path (string) or audio buffer
params.promptstringOptional initial prompt to guide the transcription

Returns

AsyncGenerator<string> — Yields text chunks as they are transcribed.

Throws

ErrorWhen
TRANSCRIPTION_FAILEDTranscription fails

Example

const stream = transcribeStream({
  modelId: "whisper-model",
  audioChunk: "/path/to/audio.wav",
});

for await (const textChunk of stream) {
  process.stdout.write(textChunk);
}

SUPPORTED_AUDIO_FORMATS

Use this exported constant to check which audio formats are accepted before passing a file to transcribeStream(). Avoids runtime errors from unsupported formats.

import { SUPPORTED_AUDIO_FORMATS } from "@qvac/sdk";

const ext = filePath.split(".").pop();
if (!SUPPORTED_AUDIO_FORMATS.includes(ext)) {
  console.error(`Unsupported format: ${ext}`);
}

On this page