RunAnywhere.
Audio is
Float32Array samples, not PCM16 bytes. Use
RunAnywhere.pcm16ToFloat32Samples(arrayBuffer) to convert; it takes an ArrayBuffer of
little-endian int16.
VAD requires the ONNX backend:
ERROR_CODE_FEATURE_NOT_AVAILABLE.
Load a VAD model
RunAnywhere.defaultVADModelID is 'silero-vad'. ensureDefaultVAD() returns true immediately
when a VAD model is already loaded, otherwise it loads the catalogued default. It logs rather than
throws on failure, so check the return value.
Both flat verbs require a loaded VAD model. Without one they throw SDKException.notInitialized.
The energy-threshold detector is a C++ voice-agent fallback; it is not reachable through
detectVoiceActivity or streamVAD.
Detect on a buffer
VADResult
Options
DetectVoiceOptions extends Partial<VADOptions> and adds two Web-specific fields.
config is a Partial<VADConfiguration>. Its defaults come from idl/vad_options.proto:
VADOptions defaults are threshold: 0 (keep the configured threshold),
minSpeechDurationMs: 100, minSilenceDurationMs: 300, maxSpeechDurationMs: 0, and
includeStatistics: false.
Streaming
Capturing audio
AudioCapture from @runanywhere/web/browser wraps getUserMedia and emits frames at the rate the
SDK expects.
Handle API
For long-lived sessions where you want to own the component lifecycle,RunAnywhere.vad exposes a
handle-based API: create(), configure(handle, config), initialize(handle),
loadModel(handle, path, id?, name?), process(handle, samples, options?), statistics(handle),
setActivityHandler(handle, handler), start(handle), stop(handle), reset(handle),
destroy(handle).
setActivityHandler is the one push-style entry point, and it requires a handle:
resetVAD() resets the SDK-owned instance; RunAnywhere.vad.reset(handle) resets a handle
you created.
Endpointing an utterance
VAD reports per-chunk state. Turning that into “the user finished speaking” is your job: accumulate frames whileisSpeech is true, close the utterance after enough consecutive silent frames, then
pass the concatenated samples to RunAnywhere.transcribe(...).
Voice agent
For the full VAD → STT → LLM → TTS turn including microphone ownership, useVoiceAgentMicDriver
from @runanywhere/web/browser. See Voice Agent.