1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Voice Activity Detection (VAD) with dual-metric analysis.
//!
//! This module provides real-time voice activity detection using a combination
//! of energy and spectral flux metrics with adaptive baseline tracking.
//!
//! # Features
//!
//! - **Dual-metric analysis**: Energy + spectral flux for robust detection
//! - **Adaptive thresholding**: Dynamic baseline tracking for varying noise
//! conditions
//! - **Streaming support**: Maintains state across detect() calls for
//! continuous audio
//! - **Configurable sensitivity**: Extensive tuning options via `VadConfig`
//! - **Metrics instrumentation**: Performance and accuracy tracking via
//! `VadMetricsCollector`
//!
//! # Example
//!
//! ```rust,no_run
//! use std::sync::Arc;
//!
//! use speech_prep::vad::{NoopVadMetricsCollector, VadConfig, VadDetector};
//!
//! let config = VadConfig::default();
//! let metrics = Arc::new(NoopVadMetricsCollector);
//! let detector = VadDetector::new(config, metrics)?;
//!
//! // Process audio samples
//! let audio_samples: Vec<f32> = vec![0.0; 16000]; // 1 second at 16kHz
//! let speech_segments = detector.detect(&audio_samples)?;
//!
//! assert!(speech_segments.iter().all(|segment| segment.end_time >= segment.start_time));
//! # Ok::<(), speech_prep::error::Error>(())
//! ```
// Re-export main types for convenient access
pub use VadConfig;
pub use ;
pub use ;