Skip to content

[Enhancement] Add Text-to-Speech REST and WebSocket client support #33

@deepgram-robot

Description

@deepgram-robot

Summary

Add Text-to-Speech (TTS) client support to the Java SDK, covering both the REST API (single-shot synthesis) and WebSocket API (streaming synthesis). This would enable Java developers to generate speech audio from text using Deepgram's Aura voices.

Problem it solves

The Java SDK (v0.1.0) currently supports Speech-to-Text but has no TTS capabilities. Java developers building voice applications, IVR systems, or accessibility features need to generate speech audio from text. Without SDK support, they must make raw HTTP/WebSocket calls to the TTS API, handle audio encoding manually, and parse responses without typed models. Enterprise Java applications (Spring Boot, Android backends, telephony platforms) are a natural fit for TTS but are blocked by the missing SDK feature.

Proposed API

// REST TTS (single-shot)
DeepgramClient client = new DeepgramClient(apiKey);
SpeakOptions options = SpeakOptions.builder()
    .model("aura-asteria-en")
    .encoding("linear16")
    .sampleRate(24000)
    .build();

SpeakResponse response = client.speak().text("Hello, world!", options);
byte[] audioBytes = response.getAudio();
response.saveTo("output.wav");

// WebSocket TTS (streaming)
SpeakWebSocketClient ws = client.speak().stream(options);
ws.onAudio(audioChunk -> { /* play or buffer audio */ });
ws.onMetadata(metadata -> { /* timing info */ });
ws.sendText("First sentence to speak.");
ws.sendText("Second sentence to speak.");
ws.flush();
ws.close();

Acceptance criteria

  • REST TTS client with typed SpeakOptions and SpeakResponse models
  • WebSocket TTS client for streaming synthesis with event callbacks
  • Support for all Aura voice models
  • Audio encoding configuration (linear16, mp3, opus, flac)
  • Documented with usage example in README
  • Compatible with existing SDK architecture

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