Skip to main content
Version: Next

Type Alias: Qwen3AsrSpeechToText

Qwen3AsrSpeechToText = object

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:136

Qwen3-ASR speech-to-text task runner.

Properties​

dispose()​

readonly dispose: () => void

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:140

Releases all allocated native resources.

Returns​

void


stream()​

readonly stream: (options?) => AsyncGenerator<{ committed: string; nonCommitted: string; }>

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:189

Async generator for real-time microphone transcription. Feed audio with streamInsert and stop with streamStop. Yields { committed, nonCommitted } on every VAD or transcription event: committed is the finalized transcript so far; nonCommitted is the in-progress text that may still change.

Parameters​

options?​

Qwen3AsrStreamOptions

Stream options (language and optional VAD tuning). See Qwen3AsrStreamOptions.

Returns​

AsyncGenerator<{ committed: string; nonCommitted: string; }>

An AsyncGenerator yielding transcript updates.

Throws​

With code INVALID_STATE if streaming is already in progress, or INVALID_ARGUMENT if the language is unsupported.


streamInsert()​

readonly streamInsert: (audioChunk) => void

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:205

Appends a new PCM chunk to the live streaming buffer consumed by stream. Ignored when streaming is not active.

Parameters​

audioChunk​

Float32Array

The newly captured audio samples (16 kHz mono Float32 PCM).

Returns​

void


streamStop()​

readonly streamStop: () => void

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:197

Signals the stream generator to finalize the current segment and return. Safe to call even when streaming is not active.

Returns​

void


transcribe()​

readonly transcribe: (audio, options?, onToken?) => Promise<string>

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:156

Asynchronously transcribes a pre-recorded mono waveform sampled at QWEN3_ASR_SAMPLE_RATE_HZ. Audio of any length is accepted; long recordings are split at pauses the VAD finds into pieces the model can take in one pass, and silence is skipped.

Parameters​

audio​

Float32Array

Raw 16 kHz mono PCM audio samples (Float32Array).

options?​

Qwen3AsrSttOptions

Transcription options. See Qwen3AsrSttOptions.

onToken?​

(token) => void

Optional callback fired on the RN thread for each decoded transcript token.

Returns​

Promise<string>

A promise resolving to the full transcript string.

Throws​

With code INVALID_ARGUMENT if the language is unsupported, RESOURCE_BUSY if the model is in use, or RESOURCE_DISPOSED if disposed.


transcribeStop()​

readonly transcribeStop: () => void

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:175

Interrupts and stops any active transcription call.

Returns​

void


transcribeWorklet()​

readonly transcribeWorklet: (audio, options?, onToken?) => string

Defined in: extensions/speech/tasks/qwen3AsrSpeechToText.ts:166

Synchronous version of transcribe to be executed directly on the caller or worklet thread.

Parameters​

audio​

Float32Array

options?​

Qwen3AsrSttOptions

onToken?​

(token) => void

Returns​

string