earshot 1.0.0

Ridiculously fast & accurate voice activity detection in pure Rust
Documentation
  • Coverage
  • 50%
    4 out of 8 items documented0 out of 6 items with examples
  • Size
  • Source code size: 145.83 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.39 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pykeio/earshot
    54 3 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • decahedron1

Earshot

Ridiculously fast & accurate voice activity detection in pure Rust.

Achieves an RTF of 0.0007 (1,270x real time): 20x faster than Silero VAD v6 & TEN VAD - and more accurate, too!

If you find Earshot useful, please consider sponsoring pyke.io.

Usage

use earshot::Detector;

// Create a new VAD detector using the default NN.
let mut detector = Detector::default();

let mut frame_receiver = ...
while let Some(frame) = frame_receiver.recv() {
	// `frame` is Vec<i16> with length 256. Each frame passed to the detector must be exactly 256 samples.
	// f32 [-1, 1] frames are also supported with `predict_f32`.
	let score = detector.predict_i16(&frame);
	// Score is between 0-1; 0 = no voice, 1 = voice.
	if score >= 0.5 { // 0.5 is a good default threshold, but can be customized.
		println!("Voice detected!");
	}
}

Binary & memory size

Earshot is very embedded-friendly: each instance of Detector uses ~8 KiB of memory to store the audio buffer & neural network state. Binary footprint is ~100 KiB; the neural network is 75 KiB of that.

In contrast, Silero's model is 2 MiB, TEN's is 310 KiB, but both require ONNX Runtime, which adds an additional 8 MB to your binary (+ a whole lot more memory).

#![no_std]

Earshot supports #![no_std], but it does require an allocator. The std feature is enabled by default, so add default-features = false to enable #![no_std]:

[dependencies]

earshot = { version = "1", default-features = false }