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).
- 🚀 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.
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.
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.");
}
}Built-in, no setup required. Instant and reliable.
tts.registerBackend(new WindowsTTSBackend());High-quality offline voices. Requires piper.exe.
- Download: Get
piper.exeviarun-manager.bat. - Models: Download
.onnxmodels from Piper Voices. - Register:
tts.registerBackend(new PiperBackend("piper.exe", "voice.onnx"));Premium voices via REST API. Requires API keys.
tts.registerBackend(new ElevenLabsBackend("your_api_key"));FastTTS requires two components: the fasttts library and the fastcore native loader.
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>io.github.andrestubbe</groupId>
<artifactId>fasttts</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>io.github.andrestubbe</groupId>
<artifactId>fastcore</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'io.github.andrestubbe:fasttts:0.1.0'
implementation 'io.github.andrestubbe:fastcore:1.0.0'
}For projects without build tools, download the artifacts directly:
Important
Ensure fasttts.dll is either in your java.library.path or bundled within the JAR for automatic extraction via FastCore.
| 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. |
- JDK 17+
- Windows 10/11
- Visual Studio 2022 (with C++ Desktop development)
See COMPILE.md for details.
MIT License — See LICENSE for details.
Part of the FastJava Ecosystem — Making the JVM faster.