Made in Vancouver, Canada by Picovoice
Cobra is a highly accurate and lightweight voice activity detection (VAD) engine.
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 = "*"
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);
``
where
access_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
let threshold = ... // Detection threshold within [0, 1]
loop { if let Ok(voiceprobability) = cobra.process(&nextaudioframe()) { if voiceprobability >= threshold { // Detection event! } } } ```
Check out the Cobra Rust demos here