<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L669-L736) |

Bidirectional streaming synthesis session supporting `push_text()`.

```python
mp.tasks.audio.TtsStream(
    tts: `mp.tasks.audio.TextToSpeech`,
    stream_handle: ctypes.c_void_p
)
```

## Methods

### `cancel`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L697-L700)

```python
cancel() -> None
```

Cancels this stream immediately.

### `close`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L702-L706)

```python
close() -> None
```

Releases native stream resources.

### `finish_input`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L687-L695)

```python
finish_input() -> None
```

Marks the end of incremental text input and flushes clauses.

### `push_text`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L677-L685)

```python
push_text(
    text_delta: str
) -> None
```

Appends an incremental text fragment to the stream.

### `__enter__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L732-L733)

```python
__enter__() -> 'TtsStream'
```

### `__exit__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L735-L736)

```python
__exit__(
    exc_type, exc_val, exc_tb
) -> None
```

### `__iter__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/text_to_speech.py#L708-L730)

```python
__iter__() -> Iterator[`mp.tasks.audio.TtsAudioResult`]
```