What is RealtimeTTS?
RealtimeTTS is a Python text-to-speech library built for the case where the text is not finished yet. It accepts strings, generators and LLM token streams and turns them into audio with low latency: `feed()` takes an iterator, so text can keep arriving while audio is already playing. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed MIT.
Overview
RealtimeTTS is a Python text-to-speech library built for the case where the text is not finished yet. It accepts strings, generators and LLM token streams and turns them into audio with low latency: `feed()` takes an iterator, so text can keep arriving while audio is already playing. It can play speech locally, stream chunks to another process, write WAV files, and fall back across multiple engines when one is unavailable.
The engine matrix is the point of the library — local system voices, cloud APIs, free service wrappers, local neural models and voice-cloning stacks all sit behind the same `TextToAudioStream` interface. The project's recommended engine for supported Windows and Linux systems with an NVIDIA GPU is QwenEngine, which it describes as offering multilingual Qwen3-TTS quality, x-vector and ICL voice cloning, native 24 kHz PCM streaming and fast cancellation, in-process or behind a production Qwen server. `InflectEngine` is documented as the lightweight alternative for one fixed English voice on CUDA or ONNX CPU.
The maintainers publish latency figures with explicit caveats. In ten warm Linux runs on their tuned RTX 4090 setup they measured roughly 35 ms engine time-to-first-token, another 35 ms until RealtimeTTS emits its first PCM chunk, about 10 ms of silence inside that chunk, a predicted audible onset of 80.9 ms and a real-time factor of 0.108 — and they call these orientation figures, telling you to measure the complete path on your own target system. A `qwen-server` extra exposes the same native engine behind an OpenAI-compatible HTTP API with `/v1/audio/speech`, dynamic voice registration and persistent voice latents; it defaults to loopback, and LAN exposure requires a deliberate `--allow-lan` bind plus an API key or a reverse proxy that terminates TLS.
What it does
- Feed strings, generators or LLM token streams — audio starts before the text is finished
- Broad engine matrix: local system voices, cloud APIs, local neural models and voice-cloning stacks behind one interface, with fallback between them
- QwenEngine for multilingual Qwen3-TTS quality with x-vector and ICL voice cloning and native 24 kHz PCM streaming
- Outputs to local playback, chunk streaming to another process, or WAV files
- Optional OpenAI-compatible HTTP server (`qwen-server`) exposing /v1/audio/speech, dynamic voice registration and /health metrics
- Configurable sentence splitting, defaulting to stream2sentence's nltk plus rule-based consensus mode
Getting started
Install the extra for the engine you want — the traditional engines use PyAudio, so Linux and macOS need PortAudio headers first. Then build a stream and feed it.
Install with a system engine for a first smoke test
The `system` extra uses your OS voices and is the fastest path to hearing audio.
pip install "realtimetts[system]"Install PortAudio on Linux or macOS
The PyAudio-based engines need PortAudio headers present before the extras are installed. Windows has prebuilt PyAudio wheels for Python 3.10–3.13.
# Linux
sudo apt-get update
sudo apt-get install python3-dev portaudio19-dev
# macOS
brew install portaudioSpeak your first line
Keep the `__main__` guard — it matters on Windows and with engines that start worker processes.
from RealtimeTTS import TextToAudioStream, SystemEngine
if __name__ == "__main__":
stream = TextToAudioStream(SystemEngine())
stream.feed("Hello from RealtimeTTS.")
stream.play()Stream text as it arrives
`feed()` accepts an iterator, so audio plays while later chunks are still being produced. Use the same pattern with an LLM client, yielding only non-empty text chunks.
from RealtimeTTS import TextToAudioStream, SystemEngine
def text_chunks():
yield "This starts speaking quickly. "
yield "More text can arrive while audio is already playing."
if __name__ == "__main__":
stream = TextToAudioStream(SystemEngine())
stream.feed(text_chunks())
stream.play()Move up to the recommended neural engine
On x86-64 Windows or Linux with an NVIDIA GPU, the Qwen native engine is the project's recommended path; `doctor` checks the install. A headless server variant exposes the same engine over HTTP.
python -m pip install --only-binary=realtimetts-qwen-native "realtimetts[qwen]"
python -m qwentts_cpp doctor
# same engine behind an OpenAI-compatible HTTP API
pip install "realtimetts[qwen-server]"Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Reach for it to give a chat assistant a voice that starts speaking before the model has finished generating
- Reach for it for voice agents and phone-style flows where time to first audio is the number that matters
- Reach for it when you need one codebase to work across cloud TTS APIs and fully local neural engines, with fallback between them
- Reach for it to serve speech synthesis to other services over an OpenAI-compatible HTTP endpoint
How RealtimeTTS compares
RealtimeTTS alongside other open-source audio, music & voice tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| VoiceStudio | ★ 121k | A local-first desktop voice studio that clones and designs voices, dubs video, and handles dictation, running 16 text-to-speech and 11 speech-recognition engines on your own hardware. |
| Whisper | ★ 114k | OpenAI's speech recognition model that transcribes and translates audio across many languages. |
| GPT-SoVITS | ★ 64.3k | An open-source WebUI that clones a voice from a short audio sample and turns text into speech, with zero-shot and few-shot fine-tuning. |
| Voicebox | ★ 61.6k | Local-first voice studio that clones a voice from a short sample, generates speech across seven TTS engines and 23 languages, handles system-wide dictation, and speaks for agents over MCP. |
| VibeVoice | ★ 57.6k | Microsoft's text-to-speech model for generating long, expressive multi-speaker audio like podcasts. |
| whisper.cpp | ★ 55.7k | A dependency-free C/C++ port of Whisper built on ggml, running speech recognition on CPU, Metal, CUDA, Vulkan and NPUs from phones to servers. |
| Coqui TTS | ★ 46.3k | A library of text-to-speech models including the multilingual XTTS voice-cloning model. |
| RealtimeTTS | ★ 4.1k | Stream an LLM's tokens straight into speech, across a dozen engines |
