pub struct VadConfig {
pub enabled: bool,
pub sensitivity: f32,
pub padding_chunks: u32,
pub min_speech_duration_ms: u32,
}Expand description
Local Voice Activity Detection configuration.
This struct defines parameters for local VAD processing, including sensitivity, audio chunking, and speech segment filtering. Adjust these fields to control how strictly speech is detected and how short segments are filtered out.
§Fields
enabled: Whether local VAD is enabledsensitivity: Speech detection sensitivity (0.0-1.0). Lower values are stricter and less likely to classify audio as speech.padding_chunks: Number of non-speech chunks to include before and after detected speechmin_speech_duration_ms: Minimum duration (ms) for a segment to be considered valid speech
§Examples
use subx_cli::config::VadConfig;
let vad = VadConfig::default();
assert!(vad.enabled);
assert_eq!(vad.sensitivity, 0.25);Fields§
§enabled: boolWhether to enable local VAD method.
sensitivity: f32Speech detection sensitivity (0.0-1.0).
Lower values are stricter: a smaller value means the detector is less likely to classify a chunk as speech. For example, 0.25 is more strict than 0.75.
padding_chunks: u32Number of non-speech chunks to pad before and after detected speech.
min_speech_duration_ms: u32Minimum speech duration in milliseconds.
Segments shorter than this value will be discarded as noise or non-speech.
Implementations§
Source§impl VadConfig
impl VadConfig
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the local VAD configuration for correctness.
Ensures that all VAD-related parameters are within acceptable ranges and have valid values for audio processing.
§Returns
Returns Ok(()) if validation passes, or an error describing
the validation failure.
§Errors
This function returns an error if:
sensitivityis outside the valid range (0.0-1.0)