Skip to main content

fastrtc-pocket-tts

PyPI Downloads

A FastRTC-compatible Text-to-Speech (TTS) adapter for Kyutai's ultra-low latency Pocket TTS.

Pocket TTS is a highly optimized, CPU-bound model that requires no GPU and generates speech up to 6x faster than real-time (~200ms time-to-first-audio).

Features

  • ⚡ Ultra-Low Latency: ~200ms to the first audio chunk.
  • 💻 CPU-based: Runs effortlessly on Mac, Windows, and Linux without CUDA/Metal dependencies.
  • 🧵 Non-Blocking: Implements threaded async generation to keep your WebRTC/FastAPI event loops responsive.
  • 🗣️ Instant Voice Cloning: Supply a .wav file, and it clones the voice instantly.

Installation

Install via pip:

pip install fastrtc-pocket-tts

This package requires Python 3.10+ and automatically installs fastrtc and pocket-tts as dependencies.

Quickstart

Run a local conversational AI that responds to you in real-time using your computer's microphone.

from fastrtc import Stream, ReplyOnPause
from fastrtc_pocket_tts import PocketTTS, PocketVoice

# Initialize the model using a built-in voice
tts_engine = PocketTTS(default_voice=PocketVoice.ALBA)

def voice_handler(audio):
    # In a real app, you would pass `audio` to an STT and LLM here.
    # For this example, we'll just respond with static text.
    response_text = "I am speaking to you directly from your CPU."
    
    # Yield the audio stream chunks back to FastRTC
    for chunk in tts_engine.stream_tts_sync(response_text):
        yield chunk

# Mount it on a FastRTC stream
stream = Stream(ReplyOnPause(voice_handler), modality="audio", mode="send-receive")

# Launch the interactive WebRTC UI
stream.ui.launch()

Voice Cloning

Pocket TTS allows zero-shot voice cloning. Simply provide a valid path to a local audio file (.wav, .mp3) when initializing the model or passing options.

from fastrtc_pocket_tts import PocketTTS

# The model will automatically extract the voice embedding from the audio file
tts_engine = PocketTTS(default_voice="./path/to/my_voice_sample.wav")


Available Built-In Voices
If you don't want to use voice cloning, Kyutai provides 8 pre-trained English default voices:
alba, marius, javert, jean, fantine, cosette, eponine, azelma.
You can access them safely using the PocketVoice Enum:
from fastrtc_pocket_tts import PocketVoice

voice = PocketVoice.JAVERT

License

MIT License.

Metadata

Release files for fastrtc-pocket-tts 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastrtc-pocket-tts 0.1.2
File Size Uploaded
fastrtc_pocket_tts-0.1.2.tar.gz 194.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fastrtc-pocket-tts 0.1.2
File Interpreter ABI Platform
fastrtc_pocket_tts-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 199.8 kB

Release files / fastrtc_pocket_tts-0.1.2.tar.gz

Download URL fastrtc_pocket_tts-0.1.2.tar.gz
Size 194.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4bb4326ef061bbdd6fc8e5ae9bcb1bccd2174e92991cf548b277f80bedb1c278
BLAKE2b-256 checksum
How to use checksums
a06cd48317e2321a8653d833aaaf5534a377f6f257eb50d2de1705a5275a9766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fastrtc_pocket_tts-0.1.2-py3-none-any.whl

Download URL fastrtc_pocket_tts-0.1.2-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e53c2c736cf84c971165f0ab53bf6e8167c40241e402917af0297bf7ef21561
BLAKE2b-256 checksum
How to use checksums
f8621f35eb3c3d048988edfae28e1c84183e7967a393597c9a35b54c5adbb28a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page