speaker_helper.config module
Configuration for speaker-helper.
Module summary
speaker-helper reads a small, typed configuration describing where the
backend reads, and which voice / language / mode to use. Values come
from (in increasing precedence) dataclass defaults, an optional
settings.yaml, and SPEAKER_HELPER_* environment variables. Strings
spelled ${VAR} inside the YAML are expanded from the environment at load
time so hosts and secrets never sit in a committed file.
See settings.yaml.example and speaker_config.json.example at the
repository root for a documented template.
Usage example
>>> from speaker_helper.config import Settings
>>> s = Settings.from_yaml_text("backend: kokoro\nlanguage: fr\nvoice: ff_siwis")
>>> s.backend, s.voice
('kokoro', 'ff_siwis')
- class speaker_helper.config.Settings(backend='kokoro', engine='kokoro', voice='', voice_sample='', voice_id='', language='fr', normalize=True, mode='offline', first_chunk_sentences=1, mock=<factory>, clone=<factory>)[source]
Bases:
objectTop-level speaker-helper configuration.
- Parameters:
backend (str) – Which TTS backend to drive.
"kokoro"(default) runs in this process and needs no server;"openvoice"and"chatterbox"clone a voice from a recording;"mock"is deterministic and serverless, for tests and the evaluation layer. The backend is an implementation detail — the rest of the package talks only to theTTSEngineprotocol. Seespeaker_helper.engine.available_backends().engine (str) – A label carried on results, for callers that record which model produced what. It does not select the backend;
backenddoes.voice (str) – Which built-in voice reads. Empty (default) means “read the text, detect the language, and pick the voice that speaks it” — which is not a convenience: the detected language is what the phonemiser works from, and French read as English is not French in an American accent, it is an American spelling the words out.
voice_sample (str) – Path to a reference recording, for the cloning backends. Kokoro refuses one rather than ignoring it.
voice_id (str) – Deprecated spelling of
voice, kept because configuration files in the wild use it.voicewins when both are set.language (str) – ISO-639-1 target language (e.g.
"fr").normalize (bool) – Loudness-normalise the output where the backend can.
mode (str) –
"offline"or"streaming".first_chunk_sentences (int) – Streaming only: sentences in the first emitted chunk (1 → lowest time-to-first-audio, which is the number a conversation feels).
Notes
Precedence, lowest to highest: dataclass defaults →
settings.yaml→SPEAKER_HELPER_*environment variables.- classmethod from_mapping(mapping)[source]
Build settings from a plain mapping (unknown keys ignored).