# `Octoroom.Agent.TTS.TinyVoca`
[🔗](https://github.com/samrat/octoroom/blob/v0.1.0/agents/lib/octoroom/agent/tts/tiny_voca.ex#L1)

Local text-to-speech using [tiny-voca](https://huggingface.co/n4ze3m/tiny-voca)
(4.5M parameters, Apache-2.0) running on ONNX Runtime via `OnnxRuntime`.

No API key or external runtime is needed. On first use, the ONNX model
(`onnx/model.onnx`, ~21.4 MB) and `dizione` phonemizer data (~5.4 MB) are
downloaded from Hugging Face into the local cache directory and kept in
`:persistent_term`.

Built-in American English voices: `"F2"` (female, default) and `"M2"` (male).
Native audio is 24 kHz mono s16le PCM; other `:sample_rate` values are
resampled with `Octoroom.Agent.Audio.PCM16.resample/3`.

    {:ok, pcm} = Octoroom.Agent.TTS.synthesize("tiny_voca:tiny-voca", "Hello!", voice: "M2")

Besides `Octoroom.Agent.TTS`'s options (`:model`, `:voice`, `:sample_rate`),
it takes:

  * `:speed` - speaking rate multiplier (default `1.0`; larger is faster)
  * `:pitch_shift` - added to log F0 (default `0.0`; `0.058` ≈ one semitone)
  * `:pitch_range` - scales pitch movement around the mean (default `1.0`)
  * `:model_dir` - directory holding `onnx/model.onnx` and `phonemizer/`
    (defaults to `TINY_VOCA_DIR`, `:octoroom_agents`'s `:tiny_voca_dir`,
    or the OS user cache directory)
  * `:download` - download missing weights from Hugging Face on demand
    (default `true`)
  * `:overrides` - `%{word => pronunciation}` map of inline dictionary
    overrides (CMUdict ARPAbet or narrow IPA)

# `connect`

Ensures the model and phonemizer are downloaded and loaded into
`:persistent_term` so the first spoken turn has no cold-load delay.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
