Expand description
Domain-neutral run segmenter — any frame-probability sequence to contiguous runs — with a backend-agnostic voice-activity-detection (VAD) shell over it.
The segmenter at zuoer’s centre is domain-neutral; VAD is the first and
best-validated shell over it, and sound-event detection the second.
zuoer is the model-free half of either pipeline. Two layers:
- a neutral core —
RunSegmenter, the hysteresis state machine that turns any frame-probability sequence into contiguousRuns, configured byRunOptions. It knows nothing about speech: the same machine segments sound-event probabilities, one instance per class. - a VAD shell — the
VadBackendseam that accepts PCM and emits speech probabilities through asink, theSpeechSegment/SpeechSegmenter/SpeechOptionsnames for the core, and the one-shotdetect_speech_withhelper.
It owns no model, no inference runtime, and no audio I/O. A model
crate implements VadBackend over its own inference — for example an
ONNX Silero backend or a CoreML backend — and drives the segmenter with
this crate’s post-processing. The segmentation semantics are the
Silero-VAD-derived hysteresis rules; a backend declaring a different
frame geometry reuses them unchanged (see RunSegmenter).
§Shell correspondence
The Speech* surface is a set of plain type aliases plus
forwarding accessors — no wrapper, no conversion, no behavioural
difference. Code written against either spelling interoperates freely.
Each duration accessor’s with_* / set_* builder pair follows the
same mapping (with_min_speech_duration →
with_min_run_duration, and so
on). The segmenter’s own method names — push_probability,
pop_pending, finish, reset, set_sample_rate, set_frame_hop —
and Run’s accessors are already neutral and are spelled the same in
both surfaces.
§Backend seam
A backend owns its input windowing and its end-of-stream policy:
VadBackend::push feeds PCM and invokes a sink callback once per
completed model frame (zero, one, or many per call — so overlapping
windows and delayed first output are expressible), and
VadBackend::finish applies the trailing-frame policy (zero-pad the
last partial frame, or drop it). The detector needs only the backend’s
frame_hop — the samples one probability
advances the timeline — and its sample_rate.
detect_speech_with drives push then finish for one-shot offline
detection.
§Streaming seam
RunSegmenter::push_probability consumes one frame probability and
returns any run it closes directly. A streaming backend driver runs
the backend over incoming PCM to obtain frame probabilities, hands them
to RunSegmenter::push_probabilities (which buffers closed runs),
and drains them in order with RunSegmenter::pop_pending /
RunSegmenter::finish. This is the sans-I/O plumbing the backend
crates build their probability feeders on top of.
§Feature flags
serde— deriveSerialize/DeserializeforRunOptionsandSampleRate(Durationfields viahumantime-serde), withdeny_unknown_fieldsso a misspelled key in a JSON/YAML/TOML profile is refused rather than silently ignored.
Structs§
- Run
- One contiguous above-threshold run on the stream timeline.
- RunOptions
- Configuration for turning a frame-probability sequence into
Runs. - RunSegmenter
- Streaming hysteresis state machine that turns a frame-probability
sequence into contiguous
Runs.
Enums§
- Error
- Errors that can occur in this crate and in the backends it drives.
- Sample
Rate - Sample rates this crate supports directly (8 kHz and 16 kHz).
Traits§
- VadBackend
- A voice-activity-detection model backend: the push-based contract the detector drives to turn audio into speech probabilities.
Functions§
- detect_
speech_ with - One-shot offline speech detection over any
VadBackend.
Type Aliases§
- Result
- A convenient alias for results that carry this crate’s
Errortype. - Speech
Detector - Backwards-compatible alias for callers that think in “detector” rather than “segmenter” terms.
- Speech
Options - The speech-flavoured name for
RunOptions. - Speech
Segment - One speech segment on the stream timeline.
- Speech
Segmenter - The hysteresis state machine that turns speech probabilities into
SpeechSegments.