speaker_helper.transcription module
Speech-to-text via vocal-helper — the canonical transcription path.
Module summary
speaker-helper is the inverse of vocal-helper (speech→text); when it needs
to go the other way — to read what a recording says — it reuses vocal-helper
rather than reinventing an ASR stack. Two places need this:
Cloning. Adding a voice to clone should be as easy as pointing at a recording. Cloning engines need a transcript of that recording; when the caller does not supply one,
ensure_transcript()derives it withvocal-helperand caches it in a.txtsidecar so it is computed once.Evaluation round-trip.
VocalHelperTranscriberimplements the evaluation layer’sTranscriberprotocol, enabling WER/chrF fidelity scoring of synthesised audio.
vocal-helper (and its whisper.cpp backend) is an optional dependency: it is
imported lazily, and a clear error tells the user how to proceed if it is absent.
Usage example
>>> from speaker_helper.transcription import ensure_transcript
>>> # ensure_transcript("assets/ref-malo.wav") # -> transcript str (needs vocal-helper)
- class speaker_helper.transcription.VocalHelperTranscriber(language='fr')[source]
Bases:
objectAdapter exposing
vocal-helperas an evaluationTranscriber.- Parameters:
language (str) – Default language hint used when a call does not specify one.
Notes
vocal-helper’s ASR is CPU/GPU-bound and blocking, sotranscribe()runs it in a worker thread to avoid stalling the event loop.
- speaker_helper.transcription.ensure_transcript(audio_path, *, language='fr')[source]
Return the transcript of
audio_path, caching it in a.txtsidecar.The first call transcribes with
vocal-helperand writes<audio_path>.txt; later calls read that file. This makes “add a voice to clone” a one-liner (supply only the audio) while paying the ASR cost once.
- speaker_helper.transcription.transcribe_bytes(wav_bytes, *, language='fr')[source]
Transcribe an in-memory WAV/audio payload with
vocal-helper.