@ai-coustics/aic-sdk 0.24.0, Core SDK 0.24.0. API index · Node.js quickstart.
Vad
Synchronous dedicated voice activity detection (VAD). Use a dedicated VAD model and one instance per stream. Initialize before processing. Input audio is read without mutation. Feed original audio before synchronous enhancement changes that buffer.
Vad.constructor
model must be a live model handle of the required type. licenseKey is the SDK credential string; see authentication. Construction is synchronous and can throw for an invalid key, a disposed model or a model-type mismatch. Omitted or null otelConfig uses environment settings; otherwise pass an OtelConfig object. There is no automatic initialization.
Vad.dispose
Vad has been disposed. Retained contexts remain readable but no new predictions are produced.
Vad.initialize
sampleRate is a whole-number rate in Hz; blockSize is a positive whole-number mono sample count. Query model.getOptimalBlockSize(sampleRate) for the preferred size. Omitted, undefined or null variableBlockSize means false, requiring exactly blockSize samples. Variable mode allows shorter blocks, with possible buffering delay, but rejects larger blocks. Unsupported configurations throw an SDK error. Initialization allocates memory. The streaming SDK accepts supported rates from 8,000 through 192,000 Hz. Call before process.
Vad.process
Float32Array samples without modifying the caller’s input. The native VAD copies the samples into its processing buffer. Returns void; read the updated prediction through getContext. Input length must match the initialized block contract. Throws before initialization, for a mismatch, after disposal or when processing is disallowed. Do not concurrently modify a shared input buffer.
Vad.getContext
Vad.terminateSession
dispose(). Completion may involve asynchronous session handling when another session remains active. Do not use it as a flush operation. Runs synchronously and may block.
VadAsync
Dedicated VAD through Node’s shared libuv worker pool. Construction and disposal are synchronous. Await initialization and each processing call in stream order. Concurrent calls on one instance share a lock but have no guaranteed submission order. Use separate instances for independent streams.
VadAsync.constructor
model must be a live model handle of the required type. licenseKey is the SDK credential string; see authentication. Construction is synchronous and can throw for an invalid key, a disposed model or a model-type mismatch. Omitted or null otelConfig uses environment settings; otherwise pass an OtelConfig object. There is no automatic initialization.
VadAsync.dispose
withConfig handle. Work that acquires the lock after disposal rejects. Await pending operations before disposing.
VadAsync.withConfig
sampleRate is a whole-number rate in Hz; blockSize is a positive whole-number mono sample count. Query model.getOptimalBlockSize(sampleRate) for the preferred size. Omitted, undefined or null variableBlockSize means false, requiring exactly blockSize samples. Variable mode allows shorter blocks, with possible buffering delay, but rejects larger blocks. Unsupported configurations reject the promise with an SDK error. Initialization allocates memory. Initializes on a worker and resolves to another handle sharing the same native VAD. Disposing either handle invalidates both. Keep the original object available for cleanup if initialization rejects.
VadAsync.initialize
sampleRate is a whole-number rate in Hz; blockSize is a positive whole-number mono sample count. Query model.getOptimalBlockSize(sampleRate) for the preferred size. Omitted, undefined or null variableBlockSize means false, requiring exactly blockSize samples. Variable mode allows shorter blocks, with possible buffering delay, but rejects larger blocks. Unsupported configurations reject the promise with an SDK error. Initialization allocates memory. Runs on a libuv worker. Await the promise before processing; initialization errors reject it.
VadAsync.process
audio on the JavaScript thread before queuing work. Resolves to a new Float32Array<ArrayBuffer> containing the original samples, not enhanced audio or VAD probabilities. The original input is unchanged. Read predictions from VadContext after awaiting the call. Format and block constraints match Vad.process; native failures reject.
VadAsync.getContext
VadContext after worker access to the instance lock. The returned context’s methods are synchronous. Rejects if the VAD was disposed before the worker acquired it.
VadAsync.terminateSession
dispose(). Completion may involve asynchronous session handling when another session remains active. Do not use it as a flush operation. Runs on a libuv worker; await it before disposal.
VadContext
Read predictions and control a Vad or VadAsync. Obtain it through the corresponding getContext() method; there is no public constructor or dispose(). All methods on this context are synchronous, including a context obtained asynchronously. The handle survives disposal of the VAD, but its prediction stops updating.
VadContext.setParameter
parameter to value, converted to a 32-bit float. Throws for an unknown enum value, an out-of-range value or a non-finite value. Timing controls are seconds; see VadParameter below.
VadContext.getParameter
VadContext.isSpeechDetected
getPredictionDelay() samples.
VadContext.getRawVadProbability
VadContext.getPredictionDelay
delaySamples * 1000 / sampleRate. It is separate from enhancement audio delay: VAD does not delay or modify the caller’s samples.
VadContext.reset
VadContext.updateBearerToken
token replaces a bearer token on a JWT-authenticated session. Both the original credential and replacement must be JWT-form licenses. A synchronous failure preserves the previous token. Return without error confirms local format acceptance, not backend acceptance; subsequent reporting can reject the token and eventually disable work. Obtain a valid replacement to recover. This operation allocates and takes a lock; keep it outside audio callbacks. See authentication.
VadParameter
Exported numeric enum used by VadContext. All defaults come from the loaded model; read them with getParameter. Timing values are seconds. The detector operates on model frames, so effective timing is quantized to frame boundaries. The stored parameter is a 32-bit float, not a measurement of the resulting decision delay.
VadParameter.SpeechHoldDuration
0. Duration in seconds, from 0 through 300 times the model window length. Controls how recent speech sustains a positive decision when the current probability is at or below the threshold: speech is reported when at least half of the frames in the lookback window (twice the hold duration) contain speech. When the current probability is above the threshold, the consecutive-frame rule set by MinimumSpeechDuration applies instead. Effective timing is rounded to model frames. Default is model-specific.
VadParameter.Sensitivity
1. Probability threshold from 0 to 1. A probability above this value counts as speech; higher values require stronger evidence. Default is model-specific.
VadParameter.MinimumSpeechDuration
2. Duration in seconds from 0 to 1. Controls the speech duration required before a positive decision. Effective timing is rounded to model frames. Default is model-specific.
Example
With the pinned package installed, setAIC_SDK_LICENSE and run node detect-block.cjs path/to/vad.aicmodel. The object printed contains a decision, probability, prediction delay and model sensitivity. One silent block does not measure detection quality. Feed representative speech and pauses in sequence to evaluate decisions.
detect-block.cjs