Skip to main content

Module speaker

Module speaker 

Source
Expand description

Who is speaking, as a vector: the contract every speaker-embedding engine implements.

An engine turns a window of 16 kHz samples into a unit-norm embedding. Two embeddings of one voice point the same way, so their cosine says whether two stretches of speech came from the same person. What to do with that number is policy, kept out of every engine: Diarizer groups voices and claims enrolled names, and SegmentReader applies it to the segments a transcription session emits.

Structs§

Diarizer
An embedding engine with enrolled profiles and anonymous voice clusters.
Enrolled
A finished enrollment: the profile to store, and the score worth showing the person who just recorded it.
Enrollment
Samples gathered so far, and the engine that measures them.
Profile
One enrolled voice.
ProfileStore
The directory of enrolled voices.
SpeakerName
An enrolled person’s name, which is also their filename. Holding one is proof it cannot escape the speakers directory.

Enums§

EnrollmentError
ProfileError
Replace
Whether storing a profile may overwrite one already there.
Role
What an enrolled voice is allowed to be. Only an owner’s voice answers “was that you?”, so a guest can be recognized by name without turning on dictation meant for the person who set the machine up.
SpeakerError
SpeakerNameError

Constants§

CLUSTER_THRESHOLD
Similarity threshold for anonymous clusters; short audio windows need a lower gate.
ENROLLED_THRESHOLD
Minimum similarity for claiming an enrolled name.
MIN_SAMPLES
Below two samples there is nothing to average and no disagreement to measure.

Traits§

Embedder
Turns audio into a comparable voice vector.
Engine
How an engine is constructed from its own configuration. NAME names the engine in stored profiles and errors; Config carries whatever it needs to load.

Functions§

centroid
Normalizes the elementwise mean of unit-length embeddings. Returns None when the mean has no direction.
consistency
Mean pairwise cosine similarity of unit-length embeddings.
normalized
Scales a vector to unit length, so cosines are plain dot products. None when the vector has no direction to keep.
open
Loads a diarizer with caller-supplied profiles. Logs model errors and returns None, allowing the caller to continue without labels.
settle
Fills missing labels from neighboring speakers. Utterance openings prefer the following label; other gaps prefer the preceding one. All-None input stays unchanged.
validate_model_file
crate::backend::validate_model_file, failing as a SpeakerError.