Offline text to speech generation, using the Kokoro-82M model.
Two tools:
speak.py— speak a fixed phrase once, with timing statssay.py— interactive keyboard control over SSH, with preset phrases, voice and speed control
Both use CUDA when available. Pass --cpu to force CPU inference.
./speak.py
./speak.py --cpu
./say.py
./say.py --cpuOn first run, the model and all voices download into cache/.
Speak a single block of text. Edit the TEXT constant in speak.py to change what is spoken.
Generated audio files are saved in audio/ as 001.wav, 002.wav, etc.
Interactive speech tool. Press keys to speak phrases.
Single keypresses work without Enter. Preset phrases are in phrases.json, triggered by keys 1–9.
| Key | Action |
|---|---|
t |
Type a custom phrase |
r |
Repeat last custom phrase |
c |
Cancel current speech |
x |
Clear queued speech |
+ / - |
Speed up / down |
v |
Next voice |
h |
Show help |
q |
Quit |
Default speed is 1.5x. Use + / - to adjust, v to change voice.
Generated audio files are saved in audio/.
Pass --test to speak the first two preset phrases and exit.
./test.py
./test.py --freshRuns speak.py and say.py --test online, with --cpu, and offline. Pass --fresh to clear cache/ and audio/ first. Requires internet when the model is not cached.
tools-offline.sh— block internet for offline testing,./tools-offline.sh --fixto restoretools-perf.sh— show CPU info
- First
say.pylaunch downloads all voices and takes longer. Later launches are faster.