Skip to content

andrestubbe/FastTTS

Repository files navigation

FastTTS v0.1.0 [ALPHA] — High-Performance Native Windows TTS API for Java

Status License: MIT Java Platform JitPack

⚡ A low-latency native Text-to-Speech module for the FastJava ecosystem. Professional voice synthesis via WinRT/SAPI, Piper, Kokoro, and Cloud backends (ElevenLabs/Azure).

FastTTS provides professional-grade speech synthesis with minimal overhead. Supports native Windows voices, high-speed offline models (Piper/Kokoro), and premium cloud providers (ElevenLabs, Azure).

FastKeyboard Showcase


Table of Contents


Quick Start

import fasttts.FastTTS;
import fasttts.backends.windows.WindowsTTSBackend;

public class Main {
    public static void main(String[] args) {
        FastTTS tts = new FastTTS();
        tts.registerBackend(new WindowsTTSBackend());
        tts.use("windows"); // Explicitly select backend

        tts.speak("FastJava is the future of native performance.");
    }
}

Features

  • 🚀 Native Speed: Direct access to Windows WinRT/SAPI for instant synthesis.
  • ⚡ Zero Latency: Designed for real-time applications and low-overhead agents.
  • 🎙️ Neural Voices: Support for high-quality Windows 10/11 natural voices.
  • 📦 Streaming Ready: Built-in support for audio chunk streaming.

Performance

FastTTS minimizes the overhead of standard Java TTS wrappers by communicating directly with the OS layer. Typical benchmark results (Windows 11, i7-12700K):

Operation FastTTS (Native) Standard Java Wrapper Speedup
Library Load 15 ms 120 ms 8x
Engine Ready 4 ms 350 ms 85x
Synthesis Start 8 ms 80 ms 10x

Note

Speedups are achieved by bypassing the JVM's reflection-heavy initialization processes found in many open-source TTS bridges.


🎙️ Engines & Setup

1. Windows Native (SAPI/WinRT)

Built-in, no setup required. Instant and reliable.

tts.registerBackend(new WindowsTTSBackend());

2. Piper Offline (AI Voices)

High-quality offline voices. Requires piper.exe.

  1. Download: Get piper.exe via run-manager.bat.
  2. Models: Download .onnx models from Piper Voices.
  3. Register:
tts.registerBackend(new PiperBackend("piper.exe", "voice.onnx"));

3. ElevenLabs & Azure (Cloud)

Premium voices via REST API. Requires API keys.

tts.registerBackend(new ElevenLabsBackend("your_api_key"));

Installation

Option 1: Maven (Recommended)

Add the JitPack repository and the dependencies to your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
   <dependency>
       <groupId>com.github.andrestubbe</groupId>
       <artifactId>fasttts</artifactId>
       <version>v0.1.0</version>
   </dependency>
   <dependency>
       <groupId>com.github.andrestubbe</groupId>
       <artifactId>fastcore</artifactId>
       <version>v0.1.0</version>
   </dependency>
</dependencies>

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.andrestubbe:fasttts:v0.1.0'
    implementation 'com.github.andrestubbe:fastcore:v0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest JARs directly to add them to your classpath:

  1. 📦 fasttts-v0.1.0.jar (The Core Library)
  2. ⚙️ fastcore-v0.1.0.jar ( The Mandatory Native Loader)

API Reference

Method Description
byte[] speak(String text) Synchronous synthesis to memory buffer.
void stream(String text, ...) Real-time streaming of audio chunks.
List<FastTTSVoice> getVoices() Enumerate all system-native voices.

Documentation

  • COMPILE.md: Full compilation guide (MSVC C++17 build chain + JNI Setup).
  • REFERENCE.md: Full API descriptions, border configurations, and codepoint index.
  • PHILOSOPHIE.md: The engineering rationale for zero-allocation performance.
  • ROADMAP.md: Future milestones and planned features.

License

MIT License — See LICENSE file for details.


Related Projects


Part of the FastJava EcosystemMaking the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

High-performance native Text-to-Speech (TTS) engine for Java. Ultra-low latency via JNI-based Windows SAPI, Piper, and Kokoro integration. Supports ElevenLabs & Azure Cloud backends with real-time streaming support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors