The Rust bindings for Picovoice’s Leopard library

3 stable releases

new 1.0.2 May 12, 2022
1.0.1 Apr 11, 2022
1.0.0 Mar 21, 2022
0.9.0 Mar 19, 2022

#140 in Machine learning

Download history 41/week @ 2022-03-15 25/week @ 2022-03-22 3/week @ 2022-03-29 23/week @ 2022-04-05 19/week @ 2022-04-12 3/week @ 2022-04-19 16/week @ 2022-04-26 15/week @ 2022-05-03 77/week @ 2022-05-10

111 downloads per month


468 lines

Leopard Binding for Rust

Leopard Speech-to-Text Engine

Made in Vancouver, Canada by Picovoice

Leopard is an on-device speech-to-text engine. Leopard is:

  • Private; All voice processing runs locally.
  • Accurate [1]
  • Compact and Computationally-Efficient [2]
  • Cross-Platform:
    • Linux (x86_64)
    • macOS (x86_64, arm64)
    • Windows (x86_64)
    • Android
    • iOS
    • Raspberry Pi (4, 3)
    • NVIDIA Jetson Nano


  • Rust 1.54+
  • Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.


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

To add the leopard library into your app, add pv_leopard to your apps Cargo.toml manifest:

pv_leopard = "*"

If you prefer to clone the repo and use it locally, first run copy.sh. (NOTE: on Windows, Git Bash or another bash shell is required, or you will have to manually copy the libs into the project). Then you can reference the local binding location:

pv_leopard = { path = "/path/to/rust/binding" }


Leopard requires a valid Picovoice AccessKey at initialization. AccessKey acts as your credentials when using Leopard SDKs. You can get your AccessKey for free. Make sure to keep your AccessKey secret. Signup or Login to Picovoice Console to get your AccessKey.


Create an instance of the engine and transcribe an audio file:

use leopard::LeopardBuilder;

let access_key = "${ACCESS_KEY}"; // AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)

let leopard: Leopard = LeopardBuilder::new(access_key).init().expect("Unable to create Leopard");
if let Ok(transcript) = leopard.process_file("${AUDIO_PATH}") {
    println!("{}", transcript);

Replace ${ACCESS_KEY} with yours obtained from Picovoice Console and ${AUDIO_PATH} to the path an audio file.

The model file contains the parameters for the Leopard engine. You may create bespoke language models using Picovoice Console and then pass in the relevant file.


The Leopard Rust demo project is a Rust console app that allows for processing real-time audio (i.e. microphone) and files using Leopard.