---
title: "TtsModel"
sidebar_label: "TtsModel"
description: "Kotlin binding reference: TtsModel."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.modelverse](../index.md)/[TtsModel](index.md)

# TtsModel

[common]\
class [TtsModel](index.md) : [PreTrainedModel](../PreTrainedModel/index.md)

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

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

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Properties

| Name | Summary |
|---|---|
| [capabilities](capabilities.md) | [common]<br>val [capabilities](capabilities.md): [Capabilities](../Capabilities/index.md)<br>What the model takes and gives, read when it opened: [Capabilities.needsReference](../Capabilities/needsReference.md) says whether every utterance needs a [VoiceReference](../VoiceReference/index.md), [Capabilities.speakKnobs](../Capabilities/speakKnobs.md) the knobs and ranges [speak](speak.md) accepts. |
| [config](config.md) | [common]<br>open override val [config](config.md): [PretrainedConfig](../PretrainedConfig/index.md)<br>The checkpoint's identity, read when the model opened. |

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)() |
| [residency](residency.md) | [common]<br>open override fun [residency](residency.md)(): [ResidencyReport](../ResidencyReport/index.md)<br>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](speak.md) | [common]<br>fun [speak](speak.md)(text: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), voice: [VoiceReference](../VoiceReference/index.md)?, options: [SpeakOptions](../SpeakOptions/index.md), listener: [SpeakListener](../SpeakListener/index.md)): [SpeakHandle](../SpeakHandle/index.md)<br>Speak [text](speak.md) in the voice [voice](speak.md) names, under [options](speak.md). Returns at once; the worker runs the request and calls [listener](speak.md) on its thread: the utterance as one [SpeechClip](../SpeechClip/index.md) through [SpeakListener.onClip](../SpeakListener/onClip.md), then [SpeakListener.onDone](../SpeakListener/onDone.md). A null [voice](speak.md) asks for the model's own voice, which a model whose [Capabilities.needsReference](../Capabilities/needsReference.md) 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](../SpeakListener/onError.md) with the library's message. |