Expand description
Rust bindings for the ai-coustics SDK.
The SDK requires a license key. Generate one at developers.ai-coustics.com.
§Installation
cargo add aic-sdk --features download-libdownload-lib fetches the matching native library during the build. See docs::linking for
the alternatives and for how the library is found at run time.
§Quick start
use aic_sdk::{include_model, ProcessorConfig, Model, Processor};
// Embed model at compile time (or use Model::from_file to load at runtime)
static MODEL: &[u8] = include_model!("path/to/model.aicmodel");
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Get your license key from the environment variable
let license_key = std::env::var("AIC_SDK_LICENSE")?;
// Load the embedded model (or download manually at https://artifacts.ai-coustics.io/)
let model = Model::from_buffer(MODEL)?;
// Get optimal configuration based on the selected model
let config = ProcessorConfig::optimal(&model);
// Create a processor and initialize it
let mut processor = Processor::new(&model, &license_key)?.with_config(&config)?;
// Process mono audio
let mut audio_block = vec![0.0f32; config.block_size];
processor.process(&mut audio_block)?;
Ok(())
}§Where to go next
docs::guide walks through the API, docs::examples has complete programs, and
docs::linking covers how the native library is linked and found.
Models and their IDs are listed at artifacts.ai-coustics.io; the product documentation lives at docs.ai-coustics.com.
§License
This Rust wrapper is distributed under the Apache 2.0 license. The core C SDK is distributed under the proprietary AIC-SDK license.
NOTICE.txt in this crate lists the third-party software distributed with the SDK.
Modules§
- docs
- Long-form documentation.
Macros§
- include_
model - Embeds the bytes of model file, ensuring proper alignment.
Structs§
- Analysis
Result - The result of analyzing an audio signal with an
Analyzer. - Analyzer
- Runs an analysis model over the audio buffered by a
Collector. - Collector
- Buffers audio for later analysis.
- File
Analyzer - Analyzes complete mono audio buffers.
- Model
- High-level wrapper for an ai-coustics model.
- Otel
Config - OpenTelemetry configuration for a
ProcessororVad. - Processor
- High-level wrapper for the ai-coustics audio enhancement processor.
- Processor
Async async - A wrapper around
Processorfor use in async contexts. - Processor
Config - Audio processing configuration passed to
Processor::initialize,Vad::initializeandCollector::initialize. - Processor
Context - Thread-safe control handle for a
Processor. - Vad
- High-level wrapper for the ai-coustics voice activity detector.
- VadAsync
async - A wrapper around
Vadfor use in async contexts. - VadContext
- Thread-safe control handle for a
Vad.
Enums§
- AicError
- Error type for AIC SDK operations.
- Dynamic
Loading Error runtime-linking - Error returned when loading the AIC dynamic library at runtime fails.
- Processor
Parameter - Configurable parameters for audio enhancement
- VadParameter
- Configurable parameters for Voice Activity Detection.
Functions§
- analyzer_
pair - Creates a collector/analyzer pair for non-real-time analysis.
- get_
compatible_ model_ version - Returns the model version compatible with the SDK.
- get_
sdk_ version - Returns the version of the SDK.
- is_
library_ loaded runtime-linking - Returns whether an AIC dynamic library has already been loaded.
- load_
library ⚠runtime-linking - Loads the AIC dynamic library from
pathwhen theruntime-linkingfeature is enabled. - set_
sdk_ ⚠id - This function is only used to identify SDKs by ai-coustics and should not be called by users of this crate.