pub struct ChunkerConfig {
pub target_duration: Duration,
pub max_duration: Duration,
pub duration_tolerance: Duration,
pub min_duration: Duration,
pub overlap_duration: Duration,
}Expand description
Configuration for the audio chunker.
Controls how audio is segmented into processing chunks.
Fields§
§target_duration: DurationTarget duration for each chunk (default: 500ms).
Chunks will be approximately this duration, but may vary by up to
duration_tolerance to align with speech boundaries.
max_duration: DurationMaximum allowed chunk duration before forced split (default: 600ms).
Long speech segments exceeding this duration will be split into multiple chunks to maintain streaming latency guarantees.
duration_tolerance: DurationTolerance for chunk duration variance (default: 100ms).
Chunks may be target_duration ± duration_tolerance to better
align with natural speech boundaries from VAD.
min_duration: DurationMinimum chunk duration to emit (default: 100ms).
Segments shorter than this are buffered or merged with adjacent chunks to avoid inefficient processing of tiny fragments.
overlap_duration: DurationDuration of overlap between adjacent chunks (default: 50ms).
Preserves acoustic context across chunk boundaries. Must be in range
20-80ms. Overlaps are stored in
ProcessedChunk::overlap_prev and ProcessedChunk::overlap_next.
Implementations§
Source§impl ChunkerConfig
impl ChunkerConfig
Sourcepub fn new(
target_duration: Duration,
max_duration: Duration,
duration_tolerance: Duration,
min_duration: Duration,
overlap_duration: Duration,
) -> Result<Self>
pub fn new( target_duration: Duration, max_duration: Duration, duration_tolerance: Duration, min_duration: Duration, overlap_duration: Duration, ) -> Result<Self>
Create a new chunker configuration with validation.
§Errors
Returns Error::InvalidInput if:
target_durationis zero or exceeds 5 secondsmax_durationis less thantarget_durationmin_durationexceedstarget_durationoverlap_durationis outside range 20-80ms
Trait Implementations§
Source§impl Clone for ChunkerConfig
impl Clone for ChunkerConfig
Source§fn clone(&self) -> ChunkerConfig
fn clone(&self) -> ChunkerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more