hearing.diarize¶
Diarization and speaker labelling for the hearing pipeline.
Two ideas, one interface (Diarizer):
The channel trick (default, free). Because capture keeps the mic and the system audio on separate channels, we already know who is local: the
MICchannel is “me”, theSYSTEMchannel is the remote participants.ChannelTrickDiarizerjust maps channel -> speaker. No model, noaudio, no error from overlap on the local side. This beats voice fingerprinting for the “is it me?” question.
Real diarization (the upgrade). To separate multiple remote speakers you need acoustic diarization.
PyannoteDiarizerwrapspyannote.audioand runs only on the system channel. A diarized transcript is standoff interval annotation with a speaker tier — see theannotation-systemsskill.
See the hearing-diarization skill for the full landscape (pyannote vs NeMo
vs WhisperX vs SpeechBrain, DER numbers, enrollment).
Classes
|
Label speakers from the capture channel — the free, reliable default. |
|
Acoustic diarization via |
- class hearing.diarize.ChannelTrickDiarizer(me_label='me', them_label='them')[source]¶
Bases:
objectLabel speakers from the capture channel — the free, reliable default.
MIC->me_label(the local user),SYSTEM->them_label(a remote participant). Segments already carrying a speaker, or coming from aMIXEDchannel, are passed through unchanged (there is nothing to infer).This is the architecture’s default diarizer whenever channel information is present. To distinguish individual remote speakers, compose this with (or replace it by)
PyannoteDiarizer.
- class hearing.diarize.PyannoteDiarizer(model='pyannote/speaker-diarization-3.1', hf_token=None, speaker_prefix='spk_')[source]¶
Bases:
objectAcoustic diarization via
pyannote.audio(the upgrade path).Runs the pretrained pipeline over the audio, then assigns each segment the speaker whose diarized turn overlaps it most. Intended to run on the system channel only (the mic channel is already known to be “me”).
Requires
pip install hearing[diarize]and a Hugging Face token with the pyannote model licenses accepted. This implementation is provided for the diarization milestone; it is import-guarded so the package works without it.