adk-audio 3.0.0

Audio intelligence and pipeline orchestration for ADK-Rust agents
Documentation
//! MLX local inference backend for Apple Silicon.
//!
//! Provides `MlxSttProvider` for on-device Whisper speech-to-text and
//! `MlxTtsProvider` for MLX TTS model loading.
//!
//! # Whisper STT (`MlxSttProvider`)
//!
//! - **Apple Silicon (`aarch64-apple-darwin`):** runs Whisper locally via
//!   `mlx-rs` on Metal GPU with greedy decoding in 30 s windows up to
//!   [`MlxSttConfig::max_duration_secs`], automatic mono downmixing and 16 kHz
//!   resampling, and a dedicated worker thread so the async runtime never
//!   blocks. Building `--features mlx` (or `--features all`) on Apple Silicon
//!   requires `cmake` and Xcode's Metal toolchain.
//! - **Other platforms:** `--features mlx` compiles (load-only) and
//!   `MlxSttProvider::transcribe` returns `AudioError::Stt` stating Apple
//!   Silicon is required.
//! - **Checkpoints:** supports unquantized safetensors checkpoints
//!   (`weights.safetensors` or `model.safetensors`), defaulting to
//!   `mlx-community/whisper-large-v3-turbo` and supporting
//!   `mlx-community/whisper-*-fp16`. `.npz`-only and quantized
//!   (`-4bit`/`-8bit`) checkpoints return `AudioError::Stt`.
//! - **Tokenizer:** uses `tokenizer.json` from the model directory when present,
//!   otherwise downloads only `tokenizer.json` from the matching
//!   `openai/whisper-*` repository based on `config.json` `n_vocab`.
//! - **Language & streaming:** `.en` checkpoints (`n_vocab < 51865`) ignore
//!   `SttOptions::language` and use `[sot, notimestamps]`; multilingual
//!   checkpoints default to `"en"` when `language` is `None`.
//!   `transcribe_stream` returns `AudioError::Stt`.
//!
//! # TTS (`MlxTtsProvider`)
//!
//! `MlxTtsProvider` loads models and tokenizers; inference is not yet
//! implemented (`synthesize` returns `AudioError::Tts`).
//!
//! Requires the `mlx` feature flag.

mod checkpoint;
mod config;
mod filters;
mod mel;
mod stt;
mod tokenizer;
mod tts;
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
mod whisper;

/// Benchmark and allocation-probe hooks for `benches/` and `tests/`; not a
/// public API and exempt from semver.
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
#[doc(hidden)]
pub use whisper::bench as __bench;

pub use config::{MlxQuantization, MlxSttConfig, MlxTtsConfig};
pub use mel::compute_log_mel_spectrogram;
pub use stt::MlxSttProvider;
pub use tts::MlxTtsProvider;