RepositoryPython
KoljaB

KoljaB/RealtimeTTS

Converts text to speech in realtime

4.1kstars
421forks
121issues
2views

Featured achievements

The project's latest awards

7
TINIX TRENDING·Topic: speech-synthesis

#7 Repository of the week

8
TINIX TRENDING·Topic: speech-synthesis

#8 Repository of the week

10
TINIX TRENDING·Topic: realtime

#10 Repository of the week

RealtimeTTS

PyPI Downloads GitHub release

RealtimeTTS is a Python text-to-speech library for applications that need to turn strings, generators, and LLM token streams into audio with low latency. It can play speech locally, stream chunks to another process, write WAV files, and fall back across multiple engines.

The project supports a broad engine matrix: local system voices, cloud APIs, free service wrappers, local neural models, and voice-cloning stacks.

Support RealtimeTTS

If RealtimeTTS saved you time, one GitHub star is a simple way to help make it more stable.

Stars improve visibility, and visibility brings more users, more real-world testing, more bug reports, more fixes, and better releases for everyone.

Demo

https://github.com/KoljaB/RealtimeTTS/assets/7604638/87dcd9a5-3a4e-4f57-be45-837fc63237e7

Install

For the fastest local smoke test, install the system engine:

pip install "realtimetts[system]"

On Linux, install PortAudio headers before installing PyAudio:

sudo apt-get update
sudo apt-get install python3-dev portaudio19-dev

On macOS:

brew install portaudio

For cloud engines, local neural engines, CUDA, mpv, and current packaging caveats, see docs/installation.md.

First Audio

from RealtimeTTS import TextToAudioStream, SystemEngine


if __name__ == "__main__":
    stream = TextToAudioStream(SystemEngine())
    stream.feed("Hello from RealtimeTTS.")
    stream.play()

Use the if __name__ == "__main__": guard in scripts, especially on Windows and when using engines that start worker processes.

Streaming Text

feed() accepts an iterator, so text can arrive while audio is already playing:

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()

Use the same pattern with an LLM client by yielding only non-empty text chunks. See docs/llm-streaming.md.

Output

Write audio to a WAV file without local speaker playback:

from RealtimeTTS import TextToAudioStream, SystemEngine


if __name__ == "__main__":
    stream = TextToAudioStream(SystemEngine())
    stream.feed("Save this speech to a file.")
    stream.play(output_wavfile="speech.wav", muted=True)

For output devices, mpv playback, muted mode, callbacks, and chunk formats, see docs/output-and-files.md.

Features

  • Low-latency playback from strings, generators, and streamed model output.
  • Multiple engines with local, cloud, free-service, and neural model options.
  • Fallback engines for more resilient synthesis.
  • Sync and async playback with pause, resume, stop, and state inspection.
  • Text, audio, sentence, character, word-timing, and audio-chunk callbacks.
  • WAV output, muted synthesis, selected output devices, and volume control.
  • Voice switching and voice-cloning workflows where supported by the engine.

Engine Overview

EngineTypeInstall/status noteBest first use
SystemEngineLocalrealtimetts[system]First local audio smoke test.
GTTSEngineFree servicerealtimetts[gtts]Simple network-backed speech.
EdgeEngineFree servicerealtimetts[edge], needs mpvFree streamed voices.
OpenAIEngineCloud APIrealtimetts[openai]OpenAI TTS voices.
AzureEngineCloud APIrealtimetts[azure]Azure voices and word timings.
ElevenlabsEngineCloud APIrealtimetts[elevenlabs], needs mpvHigh-quality API voices.
CambEngineCloud APIrealtimetts[camb]CAMB MARS API voices.
MiniMaxEngineCloud APIrealtimetts[minimax]MiniMax cloud voices.
CartesiaEngineCloud APIrealtimetts[cartesia]Cartesia API voices.
TypecastEngineCloud APIrealtimetts[typecast]Typecast API voices.
ModelsLabEngineCloud APIrealtimetts[modelslab], root export pendingModelsLab API voices.
CoquiEngineLocal neuralrealtimetts[coqui]Local XTTS voice cloning.
PiperEngineLocal executablerealtimetts[piper], external Piper setupFast local executable TTS.
StyleTTSEngineLocal neuralrealtimetts[styletts], local checkout/assetsStyleTTS experiments.
ParlerEngineLocal neuralrealtimetts[parler]GPU local model experiments.
KokoroEngineLocal neuralrealtimetts[kokoro]Local voices and timing support.
OrpheusEngineLocal/API-stylerealtimetts[orpheus]Orpheus model workflows.
FasterQwenEngineLocal neuralrealtimetts[qwen]Qwen voice cloning.
OmniVoiceEngineLocal neuralrealtimetts[omnivoice]Multilingual voice cloning.
PocketTTSEngine / PocketTTSGpuEngineLocal lightweightrealtimetts[pockettts], realtimetts[pockettts-gpu] plus GPU forkCPU-oriented voice cloning, optional CUDA fork path.
NeuTTSEngineLocal neuralrealtimetts[neutts], optional neutts-ggufReference-audio voice cloning.
ZipVoiceEngineLocal neuralrealtimetts[zipvoice], external checkoutZipVoice cloning/server demos.
LuxTTSEngineLocal neuralrealtimetts[luxtts]LuxTTS voice cloning.
ChatterboxEngineLocal neuralrealtimetts[chatterbox]Chatterbox prompt-audio voices.
SoproTTSEngineLocal neuralrealtimetts[sopro]Sopro reference-audio voices.
SopranoEngineLocal neuralrealtimetts[soprano]Soprano local synthesis.
MossTTSEngineLocal neuralrealtimetts[moss], runtime assetsMOSS-TTS experiments.

See docs/engine-selection.md before choosing an engine for an application. The engine-specific docs are being split out from the old README and source audit.

Documentation

  • Quick start: shortest working examples.
  • Installation: extras, platform setup, external tools, API keys, and known packaging mismatches.
  • Engine selection: engine matrix and selection guidance.
  • Feed and playback: feed(), play(), play_async(), pause, resume, stop, text state, and inline tags.
  • LLM streaming: provider-neutral streamed text patterns and latency tuning.
  • Output and files: WAV files, audio chunks, muted mode, output devices, mpv, buffering, and volume.
  • Engine setup pages now link one focused page for each concrete engine source.
  • FAQ: legacy troubleshooting page while topic docs are being split out.

Legacy translated docs remain under docs/<locale>/ while English is refactored as the canonical source.

Server Example

The browser and WebSocket server example lives in example_fast_api/:

python -m pip install fastapi uvicorn websockets pyaudio
python example_fast_api/async_server.py

Open http://localhost:8000 or connect to ws://localhost:8000/ws.

RealtimeSTT is the speech-to-text counterpart for realtime voice input.

Contributing

Focused docs, tests, and engine fixes are easiest to review. During the docs refactor, keep English docs canonical and note mismatches between source, packaging, examples, and tests rather than hiding them.

License

RealtimeTTS source code is MIT licensed. Engine providers, model weights, voice data, datasets, generated audio, and third-party services can have separate terms. Read LICENSING_ADDENDUM.md and the relevant provider or model licenses before commercial use.

Audio samples derived from the EARS dataset by Meta are licensed under CC BY-NC 4.0. See the original dataset terms for details.

Author

Kolja Beigel

Similar Projects

Discover other similar projects and AI models.

RepositoryPython
harry0703/MoneyPrinterTurbo

利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.

147.3k
Dec 1, 2026
RepositoryPython
OpenBMB/VoxCPM

VoxCPM2: Tokenizer-Free TTS for Multilingual Speech Generation, Creative Voice Design, and True-to-Life Cloning

43.1k
Nov 9, 2026
Modeltext-to-speech
hexgrad/Kokoro-82M

Kokoro is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, Kokoro can be...

♥0
13.9M
Apr 10, 2025
RepositoryPython
rany2/edge-tts

Python library and CLI for Microsoft Edge's online text-to-speech: neural voices, MP3 output, SRT subtitles. No Edge or API key needed.

12.7k
Dec 1, 2026
RepositoryPython
open-mmlab/Amphion

Amphion (/æmˈfaɪən/) is a toolkit for Audio, Music, and Speech Generation. Its purpose is to support reproducible research and help junior researchers and engineers get started in the field of audio, music, and speech generation research and development.

10.4k
Mar 25, 2026
RepositoryPython
netease-youdao/EmotiVoice

EmotiVoice 😊: a Multi-Voice and Prompt-Controlled TTS Engine

8.5k
Sep 3, 2026
RepositoryPython
Neywa-Labs/mlx-audio

A text-to-speech (TTS), speech-to-text (STT) and speech-to-speech (STS) library built on Apple's MLX framework, providing efficient speech analysis on Apple Silicon.

8.3k
Nov 25, 2026
RepositoryPython
jaywalnut310/vits

VITS: Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech

7.9k
Dec 6, 2023
RepositoryPython
donnemartin/system-design-primer

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

379.9k
Sep 15, 2026