aic-sdk==3.2.0. Core SDK: 0.24.0. Source: Python wrapper 3.2.0.
The fragments below use these imports. Supply license_key from your approved secret source and use the loaded model and initialized objects described in each section. For a complete file-processing example and tuning guidance, follow the ai-coustics VAD guide.
audio denotes a one-dimensional NumPy float32 array. Async fragments run inside an async function.
Vad
class
Stateful voice activity detector (VAD) backed by a dedicated VAD model. Use one instance per independent stream and serialize initialization and processing on each instance. Native resources are released when Python releases the object. Feed mono audio toprocess() and read predictions through get_context(). The audio is not modified; processing only updates the detector’s prediction.
When enhancement and VAD run together, feed the VAD the original input audio, not the enhanced output of Processor.process(). Run both on the same block instead of chaining them:
Vad() constructor
vad-ms-2.1-xxs-16khz. Enhancement models raise ModelTypeUnsupportedError.
If config is provided, the VAD is initialized immediately. Otherwise, call initialize() before processing audio.
Parameters
str
required
SDK key or JWT for the ai-coustics SDK.
ProcessorConfig | None
default:"None"
Optional audio configuration. See
ProcessorConfig.OtelConfig | None
default:"None"
Optional per-instance OpenTelemetry configuration. See
OtelConfig.Vad.initialize()
AudioConfigUnsupportedError.
For the most frequent prediction updates, use ProcessorConfig.optimal(model).
Parameters
ProcessorConfig
required
Audio configuration. See
ProcessorConfig.Vad.process()
float32 array of normalized mono samples. Its length must equal config.block_size, or be 1 through config.block_size when variable blocks are enabled. Native work releases the GIL. A contiguous array is read directly; a strided view is copied. Do not mutate a shared input while the call runs. Wrong dtype or dimensionality raises TypeError.
Returns None: VAD processing does not modify the audio. Read the updated prediction through get_context().
When enhancement and VAD run together, pass the original input audio here, not the enhanced output of Processor.process().
Raises
NotInitializedError: If the VAD has not been initialized.AudioConfigMismatchError: If the block size does not match the configuration.ProcessingNotAllowedError: If processing is not authorized.
Vad.get_context()
VadContext for reading predictions and controlling the VAD.
Vad.terminate_session()
VadAsync
class
Async voice activity detector backed by a dedicated VAD model. Awaitable processing runs on the shared SDK processing pool. The constructor andget_context() are synchronous; both can block. Omit config at construction and await initialize_async(config) to initialize asynchronously. Await blocks in stream order and bound pending work. See async enhancement for pool settings and concurrency.
When enhancement and VAD run together, feed the VAD the original input audio, not the enhanced output of ProcessorAsync.process_async().
VadAsync() constructor
vad-ms-2.1-xxs-16khz. Enhancement models raise ModelTypeUnsupportedError.
Parameters
str
required
SDK key or JWT for the ai-coustics SDK.
ProcessorConfig | None
default:"None"
Optional audio configuration. See
ProcessorConfig.OtelConfig | None
default:"None"
Optional per-instance OpenTelemetry configuration. See
OtelConfig.VadAsync.initialize_async()
async
None after initialization. Unsupported configurations raise AudioConfigUnsupportedError when awaited. The configuration is copied into the operation.
VadAsync.process_async()
async
float32 input before dispatch, then updates the VAD prediction in the background. Await it to obtain None. Input remains unchanged; the length, dtype and SDK error rules of Vad.process() apply.
After awaiting, read the updated prediction through get_context().
When enhancement and VAD run together, pass the original input audio here, not the enhanced output of ProcessorAsync.process_async().
VadAsync.get_context()
VadContext for reading predictions and controlling the VAD.
VadAsync.terminate_session_async()
async
VadContext
class
Shared control handle for aVad.
There is no public VadContext() constructor. Contexts created by the same Vad reference the same detector. They can be used from any thread while audio is being processed elsewhere.
VadContext.is_speech_detected()
get_prediction_delay() samples. If the backing Vad stops being processed, the prediction does not update.
VadContext.raw_vad_probability()
get_prediction_delay() samples.
VadContext.set_parameter()
ParameterOutOfRangeError. Query get_parameter() for the value used by the current model.
Parameters
VadParameter
required
Parameter to modify. See
VadParameter.float
required
New parameter value.
VadContext.get_parameter()
VadContext.parameter()
deprecated
VadContext.get_prediction_delay()
Vad.process() leaves its input untouched. The value only describes how far behind its input the published prediction is, and it is independent of ProcessorContext.get_audio_delay().
VadContext.reset()
reset(), is_speech_detected() is False and raw_vad_probability() is 0.0.
VadContext.update_bearer_token()
TokenUnsupportedError is raised. Embedded NUL characters raise LicenseFormatInvalidError. A successful update is not proof of backend acceptance; continue handling processing errors.
VadParameter
enum
Parameter constants for voice activity detection. Use named constants directly; the runtime exposes PyO3 enum-like objects rather than promising standard-libraryenum.Enum iteration or .value behavior.
VadParameter members
VadParameter.SpeechHoldDuration
Controls how long the VAD continues to detect speech after the audio signal no longer contains speech. This affects the stability of speech detected -> not detected transitions. When the current probability is at or below the threshold, speech remains detected while at least half of the retained history was above threshold. The history spans approximatelyspeech_hold_duration * 2 seconds. When the current probability is above threshold, the consecutive-frame test uses MinimumSpeechDuration.
For example, a speech_hold_duration of 0.5 s sustains detection for 0.5 s after speech stops. Additional speech blocks during that period can extend detection until the 50% history threshold is no longer met.
Timing is rounded to the nearest model window: for a 10 ms window, to the nearest multiple of 10 ms.
get_parameter() returns the stored requested value, not the effective transition timing.VadParameter.Sensitivity
Probability threshold used to decide whether speech is detected. Dedicated VAD models output a speech probability for each processed audio block. A value above this threshold triggers a speech-detected decision. Range: 0.0–1.0 Default: model-specificVadParameter.MinimumSpeechDuration
Controls how long speech needs to be present in the audio signal before the VAD considers it speech. This affects the stability of speech not detected -> detected transitions.Timing is rounded to the nearest model window: for a 10 ms window, to the nearest multiple of 10 ms.
get_parameter() returns the stored requested value, not the effective transition timing.