Skip to content

Release v2.0.2

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Sep 10:13
· 1 commit to main since this release

πŸŽ™οΈ What's New in v2.0.2

This release introduces comprehensive support for the new Gemini 3.8 Flash TTS models, along with first-class Voice Design, Voice Replication, and conversational turn styling in the Interactions API.


🌟 Key Highlights

  • New TTS Models: Support for gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts (ModelOption.GEMINI_3_8_FLASH_TTS and ModelOption.GEMINI_3_8_FLASH_LITE_TTS).
  • Voice Design (type: "prompted"): Create brand new, reusable custom vocal personas from natural language descriptions describing age, timbre, accent, and persona archetype (client.createVoice(...)).
  • Voice Replication (type: "replicated"): Clone voices from reference and consent audio clips with support for both stateful managed storage (store: true) and client-managed stateless keys (store: false).
  • Voice Catalog & Discovery: List and filter prebuilt and custom voices by language, gender, pitch, persona, context, and free-text search (client.listVoices(VoiceListFilter.builder()...)).
  • Turn-Level Speech Styling (speech_metadata): Pass delivery instructions (style: "reflective and awe-inspired") and speaker assignments via Content.speech(...) or Content.SpeechAnnotation.
  • Conversational Multi-Speaker Cadence: Configure natural turn-taking dialogues using SpeakerConfig.conversational(...) with mode: "conversational".

πŸš€ Example: Designing a Custom Voice & Synthesizing Speech

Here is an end-to-end example demonstrating how to design a custom vocal persona with natural language and use it to synthesize audio with Gemini 3.8 Flash TTS:

import io.github.glaforge.gemini.interactions.GeminiInteractionsClient;
import io.github.glaforge.gemini.interactions.model.*;
import io.github.glaforge.gemini.interactions.model.Config.GenerationConfig;
import io.github.glaforge.gemini.interactions.model.Config.SpeechConfig;
import io.github.glaforge.gemini.interactions.model.Interaction.Turn;
import io.github.glaforge.gemini.interactions.model.InteractionParams.ModelInteractionParams;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

// 1. Initialize client
GeminiInteractionsClient client = GeminiInteractionsClient.builder()
    .apiKey(System.getenv("GEMINI_API_KEY"))
    .build();

// 2. Voice Design: Create a custom persona from a natural-language description
Voice customVoice = client.createVoice(Voice.prompted(
    ModelOption.GEMINI_3_8_FLASH_TTS,
    "Warm British Astronomer",
    "A warm, thoughtful astronomer in his late 60s with a gentle British accent, speaking with quiet wonder."
));

System.out.println("Created custom voice ID: " + customVoice.id());

// (Optional) Audition the generated sample audio preview returned by CreateVoice
if (customVoice.sampleAudio() != null) {
    Files.write(Path.of("voice_preview.wav"), customVoice.sampleAudio().decodedBytes());
}

// 3. Synthesize speech using Gemini 3.8 Flash TTS and the custom designed voice
Interaction interaction = client.createInteraction(ModelInteractionParams.builder()
    .model(ModelOption.GEMINI_3_8_FLASH_TTS)
    .input(Turn.user(Content.speech(
        "Look out past the rings of Saturn. Those faint photons left their source millions of years ago.",
        "reflective and awe-inspired" // Turn-level delivery style
    )))
    .generationConfig(GenerationConfig.builder()
        .speechConfig(List.of(new SpeechConfig(customVoice.id(), "en-GB")))
        .build())
    .build());

// 4. Save generated WAV audio
byte[] wavData = interaction.outputAudio().data();
Files.write(Path.of("designed_voice_output.wav"), wavData);
System.out.println("Saved synthesized audio: designed_voice_output.wav");

πŸ“¦ Artifacts Published to Maven Central

<dependency>
    <groupId>io.github.glaforge</groupId>
    <artifactId>gemini-interactions-api-sdk</artifactId>
    <version>2.0.2</version>
</dependency>

Changelog

  • feat: support Gemini 3.8 Flash TTS, Voice Design, and Voice Replication (161ea48)
  • chore: release version v2.0.2 (413403c)