Revoize SDK Rust API Reference
ModelType Enum
The ModelType enum defines the AI models available in the Revoize SDK:
rust
#[derive(Debug)]
pub enum ModelType {
/// **Capella:** A lightweight model designed for real-time applications.
Capella,
/// **Algol:** A generative model with advanced capabilities.
Algol,
/// **Regulus:** A lightweight model designed for real-time applications.
Regulus,
/// **Octantis:** A lightweight model designed for real-time applications.
Octantis,
}init Function
Signature
rust
pub fn init(model_type: ModelType) -> Result<(), Box<dyn std::error::Error>>The init function is your starting point for using the Revoize SDK. It sets up the SDK with the specified model type. Note: Make sure to call this function before any other SDK functions to ensure everything is properly set up.
Parameters
model_typeThe model type to initialize the SDK with.
Returns
A Result indicating success or failure:
Ok(())if initialization is successful.Errif an error occurs during initialization (e.g., session creation, state setup, or missing model constants).
Errors
An error is returned if initialization fails at any step.
Example
rust
use revoize_sdk::init;
use revoize_sdk::ModelType;
fn main() {
// Initialize the SDK with the Capella model.
init(ModelType::Capella).expect("Failed to initialize Revoize SDK");
}process Function
Signature
rust
pub fn process(audio_chunk: &[f32]) -> Result<Vec<f32>, Box<dyn std::error::Error>>The process function takes an input audio chunk and returns the enhanced chunk.
WARNING
- Ensure
init()is called before using this function. - The
audio_chunkshould be from a 48 kHz recording.
Parameters
audio_chunkA slice off32representing single-channel audio samples. The samples should originate from a 48 kHz recording.
Returns
Result<Vec<f32>, Box<dyn std::error::Error>>- On success, returns a vector of enhanced audio samples. Otherwise, returns an error if processing fails (e.g., if the SDK has not been initialized).
Example
rust
use revoize_sdk::{init, process};
use revoize_sdk::ModelType;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the SDK before processing audio.
init(ModelType::Capella)?;
// Prepare an audio chunk from a 48 kHz recording.
let audio_chunk = vec![1.0_f32; 480 * 10]; // 10 frames of 480 samples each
let enhanced_audio = process(&audio_chunk)?;
println!("Enhanced audio has {} samples", enhanced_audio.len());
Ok(())
}