Skip to main content

cortana-tts

A standalone, pip-installable local TTS server with ready-made integrations for Claude Code, OpenCode, and GitHub Copilot CLI.

Speaks assistant responses aloud in real time using a fast, on-device neural TTS model — no cloud, no API keys.


Requirements

Engine Python version
Lightweight (piper-tts) Python 3.10+
Standard (neural) Python 3.10–3.12 (PyTorch does not yet support 3.13+)

Linux also requires PortAudio:

sudo apt install libportaudio2   # Debian/Ubuntu
sudo pacman -S portaudio          # Arch
brew install portaudio            # macOS (if not auto-bundled)

Windows requires the Visual C++ Redistributable.


Install

pip install cortana-tts

Engine options

Engine Install size Voices Requires
Standard (default) ~1.5 GB 22 neural voices PyTorch + HuggingFace
Lightweight ~80 MB 5 English voices Nothing extra

The setup wizard will ask which you prefer on first run. You can also switch at any time:

cortana-tts engine                    # show current engine
cortana-tts engine standard           # switch to standard (kokoro)
cortana-tts engine lightweight        # switch to lightweight (piper-tts)
cortana-tts engine lightweight en_US-ryan-medium  # switch with specific voice

Available lightweight voices: en_US-lessac-medium, en_US-ryan-medium, en_US-amy-medium, en_GB-alba-medium, en_GB-northern_english_male-medium


Quick start

# Start the server (foreground)
cortana-tts start

# Start in background
cortana-tts start --bg

# Test speech
cortana-tts speak "Hello. The server is running."

# Check status
cortana-tts status

# Stop background server
cortana-tts stop

The server listens on http://127.0.0.1:5111 by default.


Integrations

Claude Code

Installs notify.sh (or .ps1 on Windows) and status.sh into ~/.config/cortana-tts/hooks/, then registers them as Claude Code hooks in ~/.claude/settings.json.

cortana-tts install claude

Claude Code must be restarted to pick up the new hooks. After that, every response containing a <!-- <tts>...</tts> --> tag will be spoken aloud automatically.

Uninstall:

cortana-tts uninstall claude

OpenCode

Copies integrations/opencode/index.ts to ~/.config/opencode/plugins/cortana-tts.ts and registers it in ~/.config/opencode/opencode.json.

cortana-tts install opencode

Uninstall:

cortana-tts uninstall opencode

GitHub Copilot CLI

Appends a shell function to ~/.zshrc and ~/.bashrc (or PowerShell profile on Windows) that wraps gh copilot and speaks the response.

cortana-tts install copilot
source ~/.zshrc   # or restart your shell

Uninstall:

cortana-tts uninstall copilot

Voices

22 voices are available. Switch at any time — the new voice takes effect immediately.

cortana-tts voice list
cortana-tts voice set af_heart
Category Voices
American female af_heart, af_bella, af_nicole, af_sarah, af_sky, af_aoede, af_kore, af_stella, af_jessica, af_river
American male am_adam, am_eric, am_liam, am_michael, am_puck
British female bf_isabella, bf_alice, bf_emma, bf_lily
British male bm_daniel, bm_george, bm_lewis

Configuration

Config is read from ~/.config/cortana-tts/.env (or the path in $CORTANA_TTS_CONFIG).

Copy the example and edit:

cp .env.example ~/.config/cortana-tts/.env

Key settings:

Variable Default Description
TTS_ENGINE standard standard (kokoro) or piper (lightweight)
TTS_VOICE af_heart Active voice (standard engine)
TTS_PIPER_VOICE en_US-lessac-medium Active voice (piper engine)
TTS_PORT 5111 Server port
TTS_SPEED 1.1 Speech speed multiplier
CORTANA_TTS_SERVER http://127.0.0.1:5111 Server URL (for hook scripts)
ALERT_CACHE_DIR ~/.config/cortana-tts/alert_cache Pre-generated audio cue cache
TTS_DEBUG_DUMP 0 Set to 1 to save WAV files to ~/Desktop/tts_debug/

API endpoints

The server exposes these HTTP endpoints:

Method Path Description
GET /health Health check + uptime
POST /speak Speak text {"text": "...", "mood": "error"}
POST /stop Stop current playback
POST /alert Play a random pre-cached alert
POST /status Set state {"state": "thinking"|"idle"}
POST /mute Toggle mute {"muted": true}
POST /voice Switch voice {"voice": "af_heart"}
POST /playback-mode Set mode {"mode": "chunked"|"full"}
POST /voice-cue-mode Set cue frequency {"mode": "off"|"once"|"15s"|"30s"|"always"}
WS /ws/status JSON state/amplitude stream
WS /ws/audio Base64 PCM audio stream

TTS tag format

For Claude Code integration, responses should include a hidden TTS summary:

<!-- <tts>Your spoken summary here.</tts> -->
<!-- <tts mood="error">Something went wrong.</tts> -->

Valid moods: error, success, warn, melancholy (omit for default).


Platform notes

Linux: Requires libportaudio2. Install with sudo apt install libportaudio2.

macOS: PortAudio is bundled with sounddevice wheels. No extra steps needed.

Windows: Requires Visual C++ Redistributable 2015–2022. Hook scripts use PowerShell (.ps1). The cortana-tts install claude command automatically selects the correct scripts.


PID file location

Platform Path
Linux / macOS ~/.local/state/cortana-tts/server.pid
Windows %LOCALAPPDATA%\cortana-tts\server.pid

CLI reference

cortana-tts start [--port 5111] [--voice af_heart] [--bg]
cortana-tts stop
cortana-tts restart
cortana-tts status
cortana-tts voice list
cortana-tts voice set <name>
cortana-tts speak "<text>"
cortana-tts engine
cortana-tts engine standard
cortana-tts engine lightweight [voice]
cortana-tts install claude|opencode|copilot
cortana-tts uninstall claude|opencode|copilot

Metadata

Release files for cortana-tts 0.3.4

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

Source distribution (sdist)

Source distribution for cortana-tts 0.3.4
File Size Uploaded
cortana_tts-0.3.4.tar.gz 37.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cortana-tts 0.3.4
File Interpreter ABI Platform
cortana_tts-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 68.6 kB

Release files / cortana_tts-0.3.4.tar.gz

Download URL cortana_tts-0.3.4.tar.gz
Size 37.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b766754b25cbd2d83cd51145d76a85563392e634ea20b69ba26020beeb2bdc49
BLAKE2b-256 checksum
How to use checksums
43a038f8dffbe451c22f41f35d443430ee7b636167b6b053f478f01e8e2d868b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / cortana_tts-0.3.4-py3-none-any.whl

Download URL cortana_tts-0.3.4-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1265b614ad8823825bdf13a7a3cf7a73d4bd2ac7fdf81944888d368b7479f438
BLAKE2b-256 checksum
How to use checksums
ec938ccd948bf6912f8580a7bae405b0dfb1686662577b182262b4086ed04cc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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