hearing.stt¶
Speech-to-text for hearing — now backed by the scribed transcription façade.
hearing no longer implements its own STT engines. It consumes scribed (one
façade over many engines) and adapts scribed’s normalized Transcript/Segment
spine to hearing’s TranscriptSegment data model. The rest of
the architecture still sees only the STTEngine Protocol:
transcribe(audio) -> segments and stream_transcribe(frames) -> segments.
The default engine is scribed’s faster-whisper backend (local, fast). Swap engines by
changing the scribed backend= (e.g. "openai") — nothing downstream changes.
See scribed’s scribed-choose-backend skill for the full engine landscape, pricing,
and the local-vs-cloud decision.
Engines by friendly name (ENGINE_ALIASES, used by get_engine() and the
CLI’s --engine):
whisper— faster-whisper, local, any CPU/GPU (default;hearing[whisper])openai— OpenAI transcription API (hearing[openai],OPENAI_API_KEY)deepgram— Deepgram Nova-3 (hearing[deepgram],DEEPGRAM_API_KEY)mlx/parakeet— Whisper / Parakeet-TDT on Apple Silicon (hearing[mlx])whisperx— WhisperX, aligned words + optional diarization (hearing[whisperx])
The last three are scribed backends that hearing itself contributes
(hearing.backends); they are registered with scribed on first use.
Module Attributes
Default scribed backend id for local transcription. |
|
Friendly engine name -> scribed backend id (the SSOT for |
|
Backends whose |
|
Engine names shown in help and error messages (one per backend). |
Functions
|
Deepgram (cloud) engine — Nova-3 by default; |
|
Backward-compatible constructor for the local engine (returns a |
|
Apple-Silicon (MLX) engine: mlx-whisper by default, or |
|
Backward-compatible constructor for the OpenAI engine (returns a |
|
WhisperX engine: aligned word timestamps, plus pyannote speakers if |
|
Return the project's default STT engine (scribed faster-whisper). |
|
Build a scribed-backed STT engine by friendly name (see |
Classes
|
An |
- hearing.stt.DEFAULT_BACKEND: str = 'faster-whisper'¶
Default scribed backend id for local transcription.
- hearing.stt.DeepgramSTT(*, model=None, **kwargs)[source]¶
Deepgram (cloud) engine — Nova-3 by default;
model="nova-2"etc. swaps it.Batch goes to Deepgram’s pre-recorded REST API (via scribed’s deepgram backend); the live path is scribed’s VAD-segmented stream over that batch call. Needs
pip install 'hearing[deepgram]'andDEEPGRAM_API_KEY.- Return type:
- hearing.stt.ENGINE_ALIASES: Dict[str, str] = {'cloud': 'openai', 'deepgram': 'deepgram', 'faster-whisper': 'faster-whisper', 'local': 'faster-whisper', 'mlx': 'mlx-whisper', 'mlx-whisper': 'mlx-whisper', 'nova': 'deepgram', 'openai': 'openai', 'parakeet': 'parakeet-mlx', 'parakeet-mlx': 'parakeet-mlx', 'whisper': 'faster-whisper', 'whisperx': 'whisperx'}¶
Friendly engine name -> scribed backend id (the SSOT for
get_engine/the CLI). Any other registered scribed backend id is accepted as-is.
- hearing.stt.ENGINE_NAMES = ('whisper', 'openai', 'deepgram', 'mlx', 'parakeet', 'whisperx')¶
Engine names shown in help and error messages (one per backend).
- hearing.stt.FasterWhisperSTT(*, model_size=None, **kwargs)[source]¶
Backward-compatible constructor for the local engine (returns a
ScribedSTT).Retained so existing call sites (
FasterWhisperSTT(model_size="tiny")) keep working now that the engines are centralized in scribed.- Return type:
- hearing.stt.MLXSTT(*, model=None, mlx_backend='mlx-whisper', **kwargs)[source]¶
Apple-Silicon (MLX) engine: mlx-whisper by default, or
mlx_backend="parakeet-mlx".modelis a Hugging Face repo id or (mlx-whisper) a bare Whisper size such as"small". Needs macOS on Apple Silicon andpip install 'hearing[mlx]'.- Return type:
- hearing.stt.OpenAISTT(**kwargs)[source]¶
Backward-compatible constructor for the OpenAI engine (returns a
ScribedSTT).- Return type:
- class hearing.stt.ScribedSTT(backend='faster-whisper', model_size=None, language=None, vad=None, options=<factory>)[source]¶
Bases:
objectAn
STTEnginebacked by scribed — the single engine hearing now uses.- Parameters:
backend (
str) – scribed backend id ("faster-whisper"default,"openai", …).model_size (
Optional[str]) – optional model override forwarded to the backend (e.g."tiny").language (
Optional[str]) – force a language code;None=> auto-detect.vad (
Optional[VAD]) – utterance segmenter forstream_transcribe(default: scribed EnergyVAD).options (
Mapping[str,Any]) – extra backend kwargs forwarded on every call (e.g.{"diarize": True}for WhisperX/Deepgram); see the backend’sparam_mapfor what it accepts.
- async stream_transcribe(frames, *, sample_rate)[source]¶
Stream finalized segments as utterances complete (via scribed’s live path).
- Return type:
- hearing.stt.WHISPER_SIZED_BACKENDS = frozenset({'faster-whisper', 'mlx-whisper', 'whisperx'})¶
Backends whose
modelaccepts a bare whisper size (“base”, “small”, …).
- hearing.stt.WhisperXSTT(*, model=None, diarize=False, **kwargs)[source]¶
WhisperX engine: aligned word timestamps, plus pyannote speakers if
diarize.Needs
pip install 'hearing[whisperx]';diarize=Truealso needs a Hugging Face token inHF_TOKEN.- Return type:
- hearing.stt.default_engine(**kwargs)[source]¶
Return the project’s default STT engine (scribed faster-whisper).
Tests and quick runs typically pass
model_size="tiny".- Return type:
- hearing.stt.get_engine(name='whisper', **kwargs)[source]¶
Build a scribed-backed STT engine by friendly name (see
ENGINE_ALIASES)."whisper"-> faster-whisper,"openai","deepgram","mlx"-> mlx-whisper,"parakeet"-> parakeet-mlx,"whisperx". Any other registered scribed backend id works too.kwargsgo toScribedSTT.- Return type:
>>> get_engine("mlx").backend 'mlx-whisper'