Skip to content

Commit b9ee589

Browse files
committed
improve example
1 parent a3dd19e commit b9ee589

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/record.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use std::time::Instant;
1414
use vad_rs::{Normalizer, Vad, VadStatus};
1515

1616
// Options
17-
static MIN_SPEECH_DUR: Lazy<usize> = Lazy::new(|| 200); // 0.6s
18-
static MIN_SILENCE_DUR: Lazy<usize> = Lazy::new(|| 500); // 1s
17+
static MIN_SPEECH_DUR: Lazy<usize> = Lazy::new(|| 700); // 0.6s
18+
static MIN_SILENCE_DUR: Lazy<usize> = Lazy::new(|| 700);
1919

2020
// Vad
2121
static VAD_BUF: Lazy<Mutex<AllocRingBuffer<f32>>> =
@@ -80,7 +80,7 @@ fn main() -> Result<()> {
8080

8181
// Loudness normalization
8282

83-
let normalizer = Normalizer::new();
83+
let normalizer = Normalizer::new(config.channels().into(), config.sample_rate().0);
8484
*NORMALIZER.lock().unwrap() = Some(normalizer);
8585

8686
let stream = match config.sample_format() {

0 commit comments

Comments
 (0)