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_', me_label='me', pipeline=None)[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. It runs on the system channel only:
MICsegments are labelledme_labelfor free (the channel trick), and the model is not run at all when there is nothing left to diarize. Pass the system-channel audio asaudio(transcribedoes).Requires
pip install hearing[diarize]and a Hugging Face token with the pyannote model licenses accepted. The import is guarded so the package works without it.pipelineis the seam: any callable({"waveform", "sample_rate"}) -> annotation(an object withitertracks(yield_label=True)) replaces the pretrained model, which is how this is tested without a model or a token.