@ai-coustics/aic-sdk-wasm 0.23.0, Core SDK 0.23.0. API index · WebAssembly quickstart.
Vad
Vad.free
finally and do not use the handle afterward. Garbage collection does not guarantee timely cleanup; free() does not acknowledge session termination.
Vad.Symbol.dispose
free() when the runtime supports Symbol.dispose; do not call both on the same handle. Otherwise, call free() in finally.
Vad.getVadContext
free() calls for the returned contexts.
Vad.initialize
sample_rate is a whole-number rate in Hz from 8,000 through 192,000; block_size is a positive whole-number count of mono samples, not bytes. Prefer the model’s optimal sample rate and block size. Unsupported block configurations throw. Pass false for fixed blocks of exactly block_size samples or true to permit shorter blocks up to that maximum. Variable blocks can add buffering delay. Initialization allocates memory and resets signal state. A failed initialization leaves processing uninitialized; correct the configuration before submitting audio again.
Vad.constructor
model and the credential in license_key. Use a short-lived JWT from your backend in browser code. Enhancement and analysis models are rejected. Construction can throw for model type, model creation or credential errors. Initialize the audio format before processing. No OpenTelemetry configuration argument is exposed.
Vad.process
Float32Array samples without changing the caller’s array. Samples are copied into WebAssembly memory and into the VAD’s processing buffer. Returns void; read the prediction through the context afterward. Requires successful initialization and the configured block length. Throws for uninitialized or mismatched audio, disallowed processing or runtime failures.
Vad.terminateSession
void return is not an acknowledgment of server delivery or immediate completion. This method neither flushes delayed audio nor frees the object. Call free() separately when finished.
VadContext
Vad.getVadContext. Its constructor is private. Each returned handle must be freed separately. Freeing it does not free its VAD. A surviving context retains state after the VAD is freed, but cannot produce new predictions.
VadContext.free
finally and do not use the handle afterward. Garbage collection does not guarantee timely cleanup; free() does not acknowledge session termination.
VadContext.Symbol.dispose
free() when the runtime supports Symbol.dispose; do not call both on the same handle. Otherwise, call free() in finally.
VadContext.getParameter
VadParameter. Duration values are in seconds. Effective timing follows model frame boundaries; do not interpret the getter as a measurement of the resulting delay.
VadContext.getPredictionDelay
VadContext.getRawVadProbability
0 through 1, before the hold and minimum-duration decision logic. A fresh or reset context reads 0 until new predictions are available.
VadContext.isSpeechDetected
false until processing provides a new decision.
VadContext.reset
VadContext.setParameter
RangeError. Defaults come from the loaded model, so query them rather than assuming a universal preset. See VadParameter below for units and ranges.
VadContext.updateBearerToken
void, not a network-completion promise.
VadParameter
VadContext.getParameter and setParameter. Defaults are supplied by the model.
VadParameter.SpeechHoldDuration
0 through the model’s maximum supported hold duration. When the current probability is at or below the threshold, the decision uses the positive-frame count in the recent lookback window. Above the threshold, the consecutive-frame rule from MinimumSpeechDuration applies. Effective timing follows frame boundaries.
VadParameter.Sensitivity
0 through 1. Lower values classify more frames as speech.
VadParameter.MinimumSpeechDuration
0 through 1, before speech is detected. Effective timing follows frame boundaries.
Read a block prediction
This helper assumes the module is initialized,model is a live dedicated VAD model, token is a backend-issued JWT and audio contains one optimal mono block. A single initial block can precede a usable prediction because of model delay and duration settings. Keep a VAD instance alive across the full stream in an integration.