speaker_helper.cli module

Command-line interface for speaker-helper.

Module summary

One command line, built with click: speaker-helper. It exposes the library as a terminal tool whose sub-commands cover the three jobs the package exists for and the operations around them:

  • synth — speak text (or stdin) into a .wav, offline or streaming, printing the measured duration and real-time factor.

  • narrate — read a document aloud and write the WebVTT cues beside the audio, so a page can follow the reading.

  • voices — list an engine’s preset voices.

  • clone — register a cloned voice from reference audio (default: the bundled ref-fr-female) and print its id; a missing transcript comes from vocal-helper.

  • speak-from — re-voice audio from a YouTube URL, a podcast feed or the microphone; see speaker_helper.sources.

  • route — choose engine + mode from measured quality↔speed evidence.

  • eval — measure the engine against a dataset and gate on versioned thresholds (exit 0 pass / 1 fail); see speaker_helper.eval.

  • install-voice — fetch an engine’s weights before anything depends on them.

  • health — report whether the configured backend can run, and exit non-zero when it cannot.

  • serve — run the REST API server; see speaker_helper.api.

Global options (--backend, --engine, --language, the --clone family, …) sit on the top-level group, so they precede the sub-command: speaker-helper --backend mock synth "hi", speaker-helper --engine kokoro voices. They are stashed on the click context and merged into the flag bag each command handler reads.

Each _cmd_* handler takes that bag and returns a process exit code, so the command logic stays testable without a terminal; the click layer above it only parses.

Usage example

speaker-helper synth "Bonjour le monde." -o hello.wav --engine kokoro
echo "Texte depuis stdin." | speaker-helper synth -o out.wav
speaker-helper --engine kokoro voices
speaker-helper route --condition online_realtime --language fr
speaker-helper serve --bind-host 0.0.0.0 --bind-port 8080

Author

Warith HARCHAOUI — https://linkedin.com/in/warith-harchaoui

speaker_helper.cli.main()[source]

Console-script entry point: run the click command group.

Return type:

None