You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/entity/tts.md
+22-21Lines changed: 22 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,11 +35,30 @@ class MyTextToSpeechEntity(TextToSpeechEntity):
35
35
"""Return a list of supported voices for a language."""
36
36
```
37
37
38
-
### Generating TTS audio
38
+
### Generating TTS audio in 1-shot
39
39
40
-
An entity can choose to implement three different ways of generating TTS audio. Only one method can be implemented at a time.
40
+
This method takes a message and language as input and returns the TTS audio. It can be implemented as either synchronous or asynchronous and is mandatory to implement.
41
41
42
-
The stream TTS audio method allows text to be streamed into the TTS service and audio to be streamed back.
### Generating TTS audio with message streaming in
58
+
59
+
Large language models generate text in chunks. The TTS service can be called with a stream of text messages, and the TTS service will return the audio in chunks.
60
+
61
+
This method is optional. When not implemented, the TTS service will call the 1-shot method with the final message.
43
62
44
63
```python
45
64
classMyTextToSpeechEntity(TextToSpeechEntity):
@@ -70,21 +89,3 @@ class TTSAudioResponse:
70
89
extension: str
71
90
data_gen: AsyncGenerator[bytes]
72
91
```
73
-
74
-
If the Text-to-Speech service requires the entire message to be sent at once, the get tts audio method can be used. It can be implemented as either synchronous or asynchronous.
0 commit comments