vad_rs/vad_result.rs
1#[derive(Debug, PartialEq)]
2pub enum VadStatus {
3 Speech,
4 Silence,
5 Unknown,
6}
7pub struct VadResult {
8 pub prob: f32,
9}
10
11// https://github.com/WenqingZong/Silero_VAD/blob/main/src/lib.rs
12impl VadResult {
13 pub fn status(&mut self) -> VadStatus {
14 if self.prob > 0.5 {
15 return VadStatus::Speech;
16 }
17 if self.prob < 0.35 {
18 return VadStatus::Silence;
19 }
20 VadStatus::Unknown
21 }
22}