API Reference¶
Model Class¶
aic.Model(model_type=AICModelType.QUAIL_L, license_key=None, *, sample_rate, channels=1, frames=None)
¶
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_frames
will be used.
close()
¶
Explicitly free native resources (idempotent).
get_parameter(param)
¶
Get the current value of a parameter.
Parameters:
-
param
(AICParameter
) –Parameter enum value. See :py:class:
aic._bindings.AICParameter
.
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 be
float32
in 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_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 be
float32
in 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.
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
) –Parameter enum value. See :py:class:
aic._bindings.AICParameter
. -
value
(float
) –New value for the parameter (float).
Raises:
-
RuntimeError
–If the parameter is out of range or the SDK call fails.