Lightweight CPU-based Text-to-Speech extension for text-generation-webui using Kyutai's Pocket TTS model.
- Lightweight: 100M parameter model (vs 1.6B for alternatives like Moshi)
- CPU-only: No GPU contention with your LLM
- Fast: 3-4x faster than realtime speech generation
- Simple: ~220 lines of code, no external servers
- 8 Built-in Voices: alba, marius, javert, jean, fantine, cosette, eponine, azelma
- Voice Cloning: Support for custom voice WAV files
- text-generation-webui
- Python 3.10+
- numpy < 2.0 (required for text-generation-webui compatibility)
cd /path/to/text-generation-webui/extensions
git clone https://github.com/jschuller/pocket_tts.git
pip install -r pocket_tts/requirements.txt-
Download and extract to
text-generation-webui/extensions/pocket_tts/ -
Install dependencies:
cd /path/to/text-generation-webui pip install -r extensions/pocket_tts/requirements.txt -
Enable the extension by adding to
user_data/CMD_FLAGS.txt:--extensions pocket_tts -
Restart text-generation-webui
The extension adds a "Pocket TTS" accordion in the Chat tab with these options:
| Setting | Description | Default |
|---|---|---|
| Activate TTS | Enable/disable audio generation | On |
| Play automatically | Autoplay audio for new responses | On |
| Show message text | Display text below audio player | Off |
| Voice | Select from 8 built-in voices | alba |
To use your own voice for cloning:
- Place a WAV file (10-30 seconds of clear speech) in the
voices/directory - The voice will appear in the dropdown menu
- Select it and generate a response
Tips for good voice cloning:
- Use high-quality audio (16kHz+ sample rate)
- Clear speech without background noise
- 10-30 seconds of varied speech
- Start text-generation-webui with the extension enabled
- Load any LLM model
- Start a chat - responses will automatically generate audio
- Use the Preview button to test voice settings
The extension hooks into these text-generation-webui extension points:
output_modifier()- Generates audio for bot responsesstate_modifier()- Disables streaming (required for TTS)history_modifier()- Removes autoplay from old messagesui()- Adds configuration UI
Install numpy < 2.0:
pip install "numpy<2.0"The TTS model loads on first use (~2-3 seconds). Subsequent responses are fast.
- Check browser autoplay settings
- Verify the extension is enabled in Session tab
- Check console for errors
- Try different voices (some work better for certain content)
- Shorter responses generally sound better
- The model works best with English text
- Model: Kyutai Pocket TTS (100M parameters)
- Sample Rate: 24kHz
- Output Format: WAV
- Voice State Caching: Voice embeddings are cached for performance
pocket_tts/
├── script.py # Main extension code
├── requirements.txt # Python dependencies
├── README.md # This file
├── LICENSE # MIT License
├── test_tts.py # Standalone test script
├── test_sentences.txt # Preview sentences
├── outputs/ # Generated audio files
└── voices/ # Custom voice WAV files
MIT License - see LICENSE file