Skip to content

[Enhancement] Add streaming TTS WebSocket client #322

Description

@deepgram-robot

Summary

Add a TTS WebSocket streaming client to the Go SDK, enabling real-time text-to-speech with chunked audio delivery — matching the TTS WebSocket support already available in the Python and JS SDKs.

Problem it solves

Go developers building voice agents, IVR systems, and real-time audio applications need streaming TTS for low-latency speech synthesis. The Go SDK currently supports TTS only via the REST endpoint (full audio response), which adds latency unacceptable for conversational use cases. A WebSocket TTS client would enable Go developers to receive audio chunks as they're generated, matching the experience in other Deepgram SDKs.

Proposed API

client := speak.NewWebSocketClient(apiKey)

err := client.Connect(speak.WebSocketOptions{
    Model:    "aura-asteria-en",
    Encoding: "linear16",
})

client.OnAudioData(func(data []byte) {
    // Play or relay audio chunk
})

client.SendText("Hello from Deepgram!")
client.Flush()
client.Close()

Acceptance criteria

  • WebSocket client for TTS streaming endpoint
  • Callback-based audio chunk delivery (matching Listen WS client pattern)
  • Supports flush and close operations
  • Supports all Aura voice models
  • Documented with usage example
  • Compatible with existing SDK architecture and error handling patterns

Raised by the DX intelligence system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions