Skip to main content

//clika-runtime/io.clika.modelverse/TtsModel

TtsModel

[common]
class TtsModel : PreTrainedModel

A text-to-speech model loaded from its files on disk, on the CPU.

Open it with open from a snapshot directory. Hand it a sentence and a reference voice with speak; the clip arrives through the listener on the model's own worker thread, one utterance at a time per model. close frees the weights and the scratch files the model wrote.

Types​

NameSummary
Companion[common]
object Companion

Properties​

NameSummary
capabilities[common]
val capabilities: Capabilities
What the model takes and gives, read when it opened: Capabilities.needsReference says whether every utterance needs a VoiceReference, Capabilities.speakKnobs the knobs and ranges speak accepts.
config[common]
open override val config: PretrainedConfig
The checkpoint's identity, read when the model opened.

Functions​

NameSummary
close[common]
open fun close()
residency[common]
open override fun residency(): ResidencyReport
Free the model and the scratch files it wrote. A running request is canceled first and the call waits for it to return; called from inside a listener callback, the free runs right after that callback's request ends instead. Idempotent.
speak[common]
fun speak(text: String, voice: VoiceReference?, options: SpeakOptions, listener: SpeakListener): SpeakHandle
Speak text in the voice voice names, under options. Returns at once; the worker runs the request and calls listener on its thread: the utterance as one SpeechClip through SpeakListener.onClip, then SpeakListener.onDone. A null voice asks for the model's own voice, which a model whose Capabilities.needsReference is true refuses. A knob under its range, a text past the model's window, an utterance the speech window cuts, or a language the model does not interpret ends in SpeakListener.onError with the library's message.