Summary
Add WebSocket-based streaming Text-to-Speech support to the Rust SDK, enabling real-time TTS audio generation and streaming playback for voice agent and interactive applications built in Rust.
Problem it solves
The Rust SDK currently has an open issue (#95) for TTS WebSocket support. Rust developers building voice agents, game engines with voice output, or embedded voice applications need streaming TTS to achieve low-latency audio responses. The REST TTS endpoint requires waiting for the full audio to generate before playback can begin, which is unacceptable for interactive use cases. Streaming TTS via WebSocket enables sub-200ms time-to-first-audio.
Proposed API
use deepgram::{Deepgram, tts::StreamingTtsOptions};
let dg = Deepgram::new("API_KEY");
let options = StreamingTtsOptions::builder()
.model("aura-asteria-en")
.encoding("linear16")
.sample_rate(24000)
.build();
let mut tts_stream = dg.tts().stream(options).await?;
// Send text, receive audio chunks
tts_stream.send_text("Hello from Deepgram").await?;
while let Some(audio_chunk) = tts_stream.next().await {
let chunk = audio_chunk?;
// Play or write audio bytes
player.write(&chunk.audio)?;
}
tts_stream.flush().await?;
tts_stream.close().await?;
Acceptance criteria
Raised by the DX intelligence system.
Summary
Add WebSocket-based streaming Text-to-Speech support to the Rust SDK, enabling real-time TTS audio generation and streaming playback for voice agent and interactive applications built in Rust.
Problem it solves
The Rust SDK currently has an open issue (#95) for TTS WebSocket support. Rust developers building voice agents, game engines with voice output, or embedded voice applications need streaming TTS to achieve low-latency audio responses. The REST TTS endpoint requires waiting for the full audio to generate before playback can begin, which is unacceptable for interactive use cases. Streaming TTS via WebSocket enables sub-200ms time-to-first-audio.
Proposed API
Acceptance criteria
StreamingTtsOptionsbuilder with model, encoding, sample_rate, and container optionsStreamtrait implementation for audio chunksexamples/directoryRaised by the DX intelligence system.