Repolode
KoljaB

KoljaB/RealtimeTTS

Python library that turns text, generators, and LLM token streams into speech with low latency, across many local and cloud TTS engines.

Stars
4,051
Forks
415
Open issues
126
Last commit
yesterday

What is it?

RealtimeTTS is a Python text-to-speech library for applications that need speech to start before the full text is ready. It accepts plain strings, generators, and LLM token streams, then plays the audio locally, streams chunks to another process, or writes WAV files.

The library wraps a wide range of engines behind one interface: operating system voices, cloud APIs such as OpenAI, Azure, and ElevenLabs, free web services, and local neural models including Coqui XTTS, Kokoro, and Piper. Engines can be chained as fallbacks so synthesis continues if one fails.

Its recommended engine is QwenEngine, which runs Qwen3-TTS locally on NVIDIA GPUs or CPUs and supports voice cloning. A headless server mode exposes the same engine through an OpenAI-compatible HTTP API.

Key features

  • 01Converts string, generator, and LLM token stream input into audio as it arrives.
  • 02Supports dozens of engines spanning system voices, cloud APIs, and local neural models.
  • 03Falls back to alternate engines when the primary engine fails.
  • 04Provides sync and async playback with pause, resume, and stop controls.
  • 05Writes WAV files and offers callbacks for text, audio chunks, and word timings.

Use cases

  • Speaking LLM responses aloud while the model is still generating text.
  • Building voice assistants or chatbots with low-latency spoken replies.
  • Batch-generating speech files from text without local audio playback.
  • Prototyping with different TTS providers behind one Python interface.

Quick start

  1. 1

    Install the system engine for a first local smoke test

    pip install "realtimetts[system]"
  2. 2

    On Linux, install PortAudio headers before traditional engine extras

    sudo apt-get update
  3. 3

    Install the PortAudio development package on Linux

    sudo apt-get install python3-dev portaudio19-dev
  4. 4

    Save the first-audio script and run it to hear speech

Things to know

  • Traditional engine extras need PyAudio and PortAudio installed first on Linux and macOS.
  • The recommended Qwen engine needs an NVIDIA GPU for GPU mode and Python 3.11 or 3.12.

In collections

Topics

FAQ

What is RealtimeTTS?
Python library that turns text, generators, and LLM token streams into speech with low latency, across many local and cloud TTS engines. RealtimeTTS is a Python text-to-speech library for applications that need speech to start before the full text is ready. It accepts plain strings, generators, and LLM token streams, then plays the audio locally, streams chunks to another process, or writes WAV files.
Is RealtimeTTS free to use? What license does it have?
RealtimeTTS is open source under the MIT license. Check the license terms before using it in commercial products.
Is RealtimeTTS still maintained?
Actively maintained. The last commit to RealtimeTTS was on Nov 6, 2026.
What can I use RealtimeTTS for?
Speaking LLM responses aloud while the model is still generating text. Building voice assistants or chatbots with low-latency spoken replies. Batch-generating speech files from text without local audio playback. Prototyping with different TTS providers behind one Python interface.
How do I install RealtimeTTS?
Install the system engine for a first local smoke test: pip install "realtimetts[system]" On Linux, install PortAudio headers before traditional engine extras: sudo apt-get update Install the PortAudio development package on Linux: sudo apt-get install python3-dev portaudio19-dev Save the first-audio script and run it to hear speech
Where can I get RealtimeTTS?
The source code and installation instructions are on GitHub: https://github.com/KoljaB/RealtimeTTS

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects