Cobra Voice Activity Detection Engine

Made in Vancouver, Canada by Picovoice

Cobra is a highly accurate and lightweight voice activity detection (VAD) engine.

Compatibility

Installation

First you will need Rust and Cargo installed on your system.

To add the cobra library into your app, add pv_cobra to your apps Cargo.toml manifest: toml [dependencies] pv_cobra = "*"

Usage

Create an instance of the engine:

```rust use cobra::Cobra;

let accesskey = "..."; // AccessKey provided by Picovoice Console (https://picovoice.ai/console/) let cobra = Cobra::new(accesskey); `` whereaccess_keyis an AccessKey which should be obtained from [Picovoice Console](https://picovoice.ai/console/).cobra` is an instance of Cobra that detects voice activities.

```rust fn nextaudioframe() -> Vec { // get audio frame }

let threshold = ... // Detection threshold within [0, 1]

loop { if let Ok(voiceprobability) = cobra.process(&nextaudioframe()) { if voiceprobability >= threshold { // Detection event! } } } ```

Demos

Check out the Cobra Rust demos here