Full-duplex speech over WebSocket#
Low latency for live interactionsWebSocket keeps a bidirectional connection open. The service can return TTS audio in chunks as it is generated, and your application can play those chunks on arrival.
In conversational and support applications, this can reduce the wait before the listener hears the first audio.
The server can send chunks to the client before the rest of the audio has been generated.
Listeners can hear the beginning while synthesis continues. This is useful for long announcements and live interactions.
Full-duplex communication
Either side can send messages while the connection is open.
The client can interrupt, change the text or adjust settings such as speaking rate and voice as the protocol allows, without waiting for the previous request to finish.
Audio events let your application play incoming audio as it arrives.Send multiple TTS requests on the same connection to reduce connection-management overhead. Java, Python and Go are available. The repository includes Chinese instructions.