Skip to content
andrestubbePublic

About

๐ŸŽ™๏ธ Ultra-Fast Zero-Shot AI Voice Cloning & Voice Conversion Engine for Java.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FastVoice 0.1.0 โ€” Ultra-Fast Zero-Shot AI Voice Cloning & Voice Conversion Engine for Java

Status License: MIT Java Platform JitPack


โšก Hardware-accelerated, zero-shot AI voice cloning and speech-to-speech conversion for the FastJava ecosystem.

FastVoice enables high-fidelity voice cloning in seconds without training heavy neural models. It extracts compact mathematical speaker embeddings (~2 KB) from short reference audio samples (3โ€“10s) and performs instant multi-engine voice cloning and conversion for Java applications.


Quick Start

import fastvoice.FastVoice;
import fastvoice.VoiceProfile;
import java.nio.file.Files;
import java.nio.file.Path;

public class Demo {
    public static void main(String[] args) throws Exception {
        // 1. Create a cloned voice profile from a 5s audio sample
        byte[] referenceAudioWav = Files.readAllBytes(Path.of("sample.wav"));
        VoiceProfile profile = FastVoice.createProfile("SpeakerName", "f5tts", referenceAudioWav);

        // 2. Export profile to a target directory
        Path exportDir = Path.of("voices", "clones");
        profile.exportToDirectory(exportDir);
        
        System.out.println("Voice cloned and exported: " + profile.name());
    }
}

Table of Contents


Why FastVoice?

Traditional voice cloning workflows require extensive dataset curation, hours of GPU fine-tuning, and large model distribution packages. FastVoice provides:

  • Zero-Shot Speaker Conditioning: Clone timbre from a 3โ€“10s audio sample without fine-tuning weights.
  • Ultra-Lightweight Voice Profiles: Acoustic speaker embeddings are stored as compact binary vectors (~2 KB), allowing thousands of voices to be indexed with minimal storage.
  • Decoupled Architecture: Clean programmatic Java API separating the voice profile format from the underlying inference engine (F5-TTS, CosyVoice, XTTS).
  • Native Ecosystem Integration: Backed by FastCore and designed to pair seamlessly with FastTTS, FastAudioProcess, and FastAudioCapture.
Feature Legacy Voice Training Heavy Python Wrappers FastVoice
Training Requirement Hours of GPU fine-tuning Varies Zero-Shot (3โ€“10s reference audio)
Profile Storage 100 MB โ€“ 2 GB per voice Varies ~2 KB per voice profile
Runtime Overhead High (PyTorch/CUDA checkpoints) Heavy process spawning Pure Java 21+ API & Native FastCore
Voice Conversion (STS) Separate complex pipelines External scripts Built-in FastVoice.convert() API
Downstream Usability Custom inference scripts Fragile CLI pipes Single-line export & synthesis

Key Features

  • โšก Zero-Shot One-Click Cloning: No model training or GPU hours required. Clones timbre from 3โ€“10s of audio in 1โ€“2 seconds.
  • ๐Ÿชถ Ultra-Compact Profiles: Stores embeddings as tiny binary vectors (~2 KB), allowing thousands of voices without disk bloat.
  • ๐Ÿ”„ Speech-to-Speech Conversion: Transform spoken recordings into any target profile's voice with prosody preservation.
  • ๐Ÿ”Œ Seamless Ecosystem Interop: Clean, decoupled Java API designed for integration with FastJava audio and speech pipelines.

Real-World Use Cases

  • ๐ŸŽ™๏ธ Personalized Voice Assistants: Generate personalized voice responses using the user's or designated speaker's timbre in real time.
  • ๐ŸŽฎ Game Character Dialogue & NPCs: Synthesize dynamic speech for dozens of characters using lightweight zero-shot profiles instead of separate multi-gigabyte models.
  • ๐ŸŽฌ Video Dubbing & Localization: Convert spoken dialogue into different languages while preserving the original actor's vocal characteristics via Speech-to-Speech conversion.
  • ๐ŸŽง Accessibility & Voice Preservation: Archive natural voice profiles from short recordings for vocal restoration and text-to-speech assistive devices.

Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Short Reference Audio (WAV)                 โ”‚
โ”‚                 (3โ€“10s Clean Voice Sample)                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚ FastAudioProcess (DSP Cleaning)
                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                          FastVoice                          โ”‚
โ”‚          โ€ข Instant Acoustic Embedding Extraction            โ”‚
โ”‚          โ€ข Zero-Shot Speaker Conditioning                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚ Lightweight Profile (~2 KB)
                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Voice Profile Storage                   โ”‚
โ”‚        โ€ข voice.json  โ€ข embedding.bin  โ€ข reference.wav       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚ Programmatic Java API
                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Downstream Application                   โ”‚
โ”‚         (Real-time Synthesis & Audio Generation)            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Performance Benchmarks

FastVoice is benchmarked using OpenJDK JMH to guarantee sub-microsecond profile instantiation and minimal I/O overhead:

Benchmark / Operation Throughput (ops/ms) Ops per Second Latency
benchmarkProfileCreation (Metadata + VoiceProfile Record) ~147,902 ops/ms > 147 Million < 7 ns
benchmarkProfileExport (Disk I/O: JSON + Binary Vector + WAV) ~0.84 ops/ms ~840 ops/s ~1.19 ms

Measured on Windows 11 (x64), JDK 21.0.12.1. Pure Java 21+ record instantiation with zero GC allocation overhead.


API Quick Reference

Class / Record Responsibility Key Methods Reference
FastVoice Central facade for backend registration and synthesis createProfile(), synthesize(), convert(), registerBackend() Reference
VoiceProfile Immutable container for embeddings and reference audio exportToDirectory(), embedding(), referenceWav() Reference
VoiceCloner Interface for cloning engine implementations extractEmbedding(), cloneAndSynthesize(), convertVoice() Reference

For complete method signatures and details, refer to docs/REFERENCE.md.


Technical Demos & Benchmarks

Case Java Example Launcher Description
Showcase Demo Demo.java run-demo.bat Creates a zero-shot voice profile from reference audio, verifies speaker metadata, and exports it to disk.
JMH Microbenchmark Suite Benchmark.java run-benchmark.bat Formal OpenJDK JMH throughput measurements across profile instantiation and disk export.

Installation

Option 1: Maven (Recommended via JitPack)

Add JitPack to your <repositories> and include the dependency in your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependencies>
    <!-- FastVoice Engine -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastVoice</artifactId>
        <version>0.1.0</version>
    </dependency>

    <!-- FastAudioProcess (DSP Denoise & Normalization) -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastAudioProcess</artifactId>
        <version>0.1.7</version>
    </dependency>

    <!-- FastCore (Unified Native Platform Loader) -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>FastCore</artifactId>
        <version>0.1.0</version>
    </dependency>
</dependencies>

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:FastVoice:0.1.0'
    implementation 'com.github.andrestubbe:FastAudioProcess:0.1.7'
    implementation 'com.github.andrestubbe:FastCore:0.1.0'
}

Option 3: Direct Download (Pre-built JAR)

Download the pre-compiled standalone JAR directly from GitHub Releases:


Documentation

  • CHANGELOG.md: Detailed version history and updates.
  • REFERENCE.md: Full API documentation and method contracts.
  • PHILOSOPHY.md: Zero-shot speaker conditioning design and architecture.
  • COMPILE.md: Build instructions and Maven commands.
  • ROADMAP.md: Upcoming engine backends and streaming conversions.

Platform Support

Platform Architecture Status Notes
Windows 10 / 11 x64 โœ… Fully Supported Native hardware acceleration via FastCore / FastSIMD
Linux x64 / AArch64 ๐Ÿšง Planned Native bindings in development
macOS (Sonoma+) Apple Silicon / x64 ๐Ÿšง Planned Native bindings in development

License

MIT License โ€” See LICENSE file for details.


Related Projects

  • FastTTS โ€” Unified, zero-bloat text-to-speech backend orchestration
  • FastSTT โ€” High-throughput local speech-to-text recognition
  • FastVAD โ€” Ultra-fast real-time Voice Activity Detection (Silero-ONNX & WebRTC)
  • FastAudioCapture โ€” Zero-copy WASAPI audio loopback & microphone capture
  • FastAudioProcess โ€” Zero-allocation audio DSP, resamplers, and timeline mixing
  • FastAudioPlayer โ€” Ultra low-latency WASAPI and DirectSound audio playback engine
  • FastCore โ€” Native library loader, FFM gateway, and platform abstraction
  • FastSIMD โ€” Vector hardware acceleration for high-throughput math and DSP

Part of the FastJava Ecosystem โ€” Making the JVM faster. Small package. Maximum speed. Zero bloat. ๐Ÿš€๐Ÿ“‹

About

๐ŸŽ™๏ธ Ultra-Fast Zero-Shot AI Voice Cloning & Voice Conversion Engine for Java.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages