Skip to main content

Crate speech_prep

Crate speech_prep 

Source
Expand description

§speech-prep

Speech-focused audio preprocessing for Rust.

  • Voice activity detection (dual-metric: energy + spectral flux)
  • Audio format detection plus WAV decoding to 16kHz mono PCM
  • Preprocessing (DC removal, high-pass filter, noise reduction, normalization)
  • Speech-aligned chunking with overlap handling
  • Quality assessment metrics

§Usage

use std::sync::Arc;
use speech_prep::{NoopVadMetricsCollector, VadConfig, VadDetector, VadMetricsCollector};

let config = VadConfig::default();
let metrics: Arc<dyn VadMetricsCollector> = Arc::new(NoopVadMetricsCollector);
let detector = VadDetector::new(config, metrics)?;

let audio_samples = vec![0.0; 16_000];
let _segments = detector.detect(&audio_samples)?;

Re-exports§

pub use buffer::AudioBuffer;
pub use buffer::AudioBufferMetadata;
pub use chunker::ChunkBoundary;
pub use chunker::Chunker;
pub use chunker::ChunkerConfig;
pub use chunker::ProcessedChunk;
pub use error::Error;
pub use error::Result;
pub use pipeline::AudioPipelineCoordinator;
pub use pipeline::ProcessingResult;
pub use pipeline::StageLatencies;
pub use preprocessing::DcHighPassFilter;
pub use preprocessing::HighpassOrder;
pub use preprocessing::NoiseReducer;
pub use preprocessing::NoiseReductionConfig;
pub use preprocessing::PreprocessingConfig;
pub use preprocessing::VadContext;
pub use time::AudioDuration;
pub use time::AudioTimestamp;
pub use types::AudioChunk;
pub use vad::NoopVadMetricsCollector;
pub use vad::SpeechChunk;
pub use vad::VadConfig;
pub use vad::VadDetector;
pub use vad::VadMetricsCollector;

Modules§

buffer
Audio buffer types for batch audio processing.
chunker
Audio chunking aligned to VAD segments.
converter
High-level audio format conversion pipeline.
error
Error types for speech-prep.
format
Audio format detection and metadata extraction for the audio pipeline.
pipeline
End-to-end audio processing coordinator.
preprocessing
Audio preprocessing module for clean, analysis-ready audio.
time
Stream-relative time types for audio processing.
types
Core types for audio processing.
vad
Voice Activity Detection (VAD) with dual-metric analysis.

Structs§

VADStats
VAD statistics snapshot.