Metadata-Version: 2.4
Name: akiki
Version: 0.0.3
Summary: Local streaming voice activity detection with Akiki VAD
Author: Akiki AI
License-Expression: Apache-2.0
Project-URL: Homepage, https://huggingface.co/Akiki-AI
Keywords: vad,audio,speech,voice-activity-detection
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: onnxruntime>=1.17
Requires-Dist: soundfile>=0.12
Provides-Extra: pytorch
Requires-Dist: torch>=2.1; extra == "pytorch"
Dynamic: license-file

# Akiki

Akiki is a lightweight Python package for streaming voice activity detection.
It identifies speech in audio and returns a speech probability, a speech/silence
decision, and timestamps for each 16 ms frame.

The model is included in the package. Processing runs locally, without a model
download, network connection, or external service.

## Install

Requires Python 3.10 or later.

```bash
pip install akiki
```

Or add it to a uv project:

```bash
uv add akiki
```

## Python usage

Akiki accepts mono audio sampled at 16,000 Hz.

```python
import soundfile as sf
from akiki import VAD

audio, sample_rate = sf.read("recording.wav", dtype="float32")

with VAD() as vad:
    for frame in vad.push(audio, sample_rate=sample_rate):
        print(frame.start_seconds, frame.end_seconds,
              frame.probability, frame.speech)
```

For live audio, call `vad.push()` repeatedly with successive audio buffers.
Buffers can have any length; incomplete frames are retained for the next call.
Call `vad.reset()` before starting a new recording. A final incomplete frame is
not padded or scored.

Use `VAD(threshold=0.6)` to set the speech decision threshold. Every frame still
includes its probability, regardless of the threshold.

## Command line

```bash
akiki recording.wav
akiki recording.wav --threshold 0.6
```

The command prints one JSON object per complete frame, containing its timestamps,
speech probability, and speech decision.

## Inference engines

Linux x86_64 wheels include the compiled Rust engine for systems with glibc
2.34 or later. Pip and uv select the compatible wheel automatically; no Rust
toolchain is needed to install it.

Akiki selects the Rust engine when a compatible native library is available,
then falls back to ONNX Runtime or PyTorch. ONNX Runtime is included as a
dependency. PyTorch is optional:

```bash
pip install 'akiki[pytorch]'
```

Choose an engine with `VAD(engine="rust")`, `VAD(engine="onnx")`, or
`VAD(engine="pytorch")`. The command-line equivalent is `--engine rust`,
`--engine onnx`, or `--engine pytorch`. An explicitly selected engine raises
an error if it is unavailable. Check `vad.engine` to see the active engine.

All engines use the same bundled model and streaming API.

## License

The package and bundled Akiki model weights are licensed under Apache-2.0.
