API Reference¶
Model Class¶
aic.Model(model_type=AICModelType.QUAIL_L, license_key=None, *, sample_rate, channels=1, frames=None, allow_variable_frames=False)
¶
RAII + context-manager convenience around the C interface.
Parameters:
-
model_type(AICModelType, default:QUAIL_L) –The neural model variant to load; defaults to :pydata:
AICModelType.QUAIL_L. -
license_key(str | bytes, default:None) –Optional signed license string. Empty string means trial mode.
Create a model wrapper.
Parameters:
-
model_type(AICModelType, default:QUAIL_L) –The neural model variant to load; defaults to :pydata:
AICModelType.QUAIL_L. -
license_key(str | bytes, default:None) –Signed license string. Required. Obtain a key at https://developers.ai-coustics.io.
-
sample_rate(int) –Input/output sample rate in Hz. Required.
-
channels(int, default:1) –Channel count. Optional, defaults to 1.
-
frames(int | None, default:None) –Optional block length in frames for streaming. If omitted, the model's :py:meth:
optimal_num_frameswill be used.
close()
¶
Explicitly free native resources (idempotent).
create_vad()
¶
Create a Voice Activity Detector bound to this model.
get_parameter(param)
¶
Get the current value of a parameter.
Parameters:
-
param(AICParameter | AICEnhancementParameter) –Parameter enum value. See :py:class:
aic._bindings.AICEnhancementParameter.
Returns:
-
float–The current value of the parameter.
library_version()
staticmethod
¶
Return the version string of the underlying AIC SDK library.
Returns:
-
str–Semantic version string.
optimal_num_frames()
¶
Return the suggested buffer length for streaming.
Returns:
-
int–Recommended block size in frames.
optimal_sample_rate()
¶
Return the suggested I/O sample rate for the loaded model.
Returns:
-
int–Sample rate in Hz.
process(pcm, *, channels=None)
¶
Enhance pcm in-place using planar processing (convenience pass-through).
Parameters:
-
pcm(ndarray) –Planar 2-D array of shape
(channels, frames)Data must befloat32in the linear -1…+1 range. Any non-conforming array is copied to a compliant scratch buffer. -
channels(int | None, default:None) –Override channel count auto-detected from
pcm. Rarely needed.
Returns:
-
ndarray–The same array instance (modified in-place) or a contiguous copy if a dtype/stride conversion had been necessary.
process_async(pcm, *, channels=None)
async
¶
Async variant of :py:meth:process executed on the model's worker thread.
process_interleaved(pcm, channels)
¶
Enhance pcm in-place using interleaved processing (convenience pass-through).
Parameters:
-
pcm(ndarray) –Interleaved 1-D array of shape
(frames,)containing interleaved audio data Data must befloat32in the linear -1…+1 range. Any non-conforming array is copied to a compliant scratch buffer. -
channels(int) –Number of channels in the interleaved data.
Returns:
-
ndarray–The same array instance (modified in-place) or a contiguous copy if a dtype/stride conversion had been necessary.
process_interleaved_async(pcm, channels)
async
¶
Async variant of :py:meth:process_interleaved executed on the model's worker thread.
process_interleaved_submit(pcm, channels)
¶
Submit :py:meth:process_interleaved to the worker thread, returning a Future.
process_sequential(pcm, channels)
¶
Enhance pcm in-place using sequential channel data processing.
Processes audio where all samples for each channel are stored sequentially (channel 0 samples, then channel 1 samples, etc.) rather than interleaved.
Parameters:
-
pcm(ndarray) –Sequential 1-D array of shape
(frames * channels,)containing sequential audio data where all samples for channel 0 come first, followed by all samples for channel 1, etc. Data must befloat32in the linear -1…+1 range. Any non-conforming array is copied to a compliant scratch buffer. -
channels(int) –Number of channels in the sequential data.
Returns:
-
ndarray–The same array instance (modified in-place) or a contiguous copy if a dtype/stride conversion had been necessary.
process_sequential_async(pcm, channels)
async
¶
Async variant of :py:meth:process_sequential executed on the model's worker thread.
process_sequential_submit(pcm, channels)
¶
Submit :py:meth:process_sequential to the worker thread, returning a Future.
process_submit(pcm, *, channels=None)
¶
Submit :py:meth:process to the model's worker thread, returning a Future.
processing_latency()
¶
Return the current output delay (in samples).
Returns:
-
int–End-to-end delay in samples at the configured sample rate.
reset()
¶
Flush the model's internal state (between recordings, etc.).
set_parameter(param, value)
¶
Update an algorithm parameter.
Parameters:
-
param(AICParameter | AICEnhancementParameter) –Parameter enum value. See :py:class:
aic._bindings.AICEnhancementParameter. -
value(float) –New value for the parameter (float).
Raises:
-
RuntimeError–If the parameter is out of range or the SDK call fails.
Voice Activity Detector¶
aic.VoiceActivityDetector(model)
¶
Voice Activity Detector bound to a :pyclass:Model.