File size: 1,031 Bytes
125985b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Python API
## `InflectTTS(model_dir, device="cpu")`
Loads one released checkpoint and its configuration. Construct the engine once and reuse it for multiple utterances.
## `synthesize(text, *, speed=1.0, variation=0.667, seed=0)`
Returns a mono `numpy.float32` waveform at 24 kHz. Empty text raises `ValueError`. `speed` must be between `0.5` and `2.0`; `variation` must be between `0.0` and `1.0`. Long input is split at punctuation-aware boundaries, and each chunk uses `seed + chunk_index`.
## `save(text, output, **kwargs)`
Synthesizes and writes a WAV file, creating parent directories as needed. It returns the output `Path`.
```python
from inference import InflectTTS
tts = InflectTTS(".", device="cpu")
waveform = tts.synthesize("A compact model can still speak clearly.", seed=7)
tts.save("This is written directly to disk.", "out.wav", seed=7)
```
The API is intentionally small. It does not expose speaker cloning, streaming state, SSML, or language switching in the v2 launch package.
|