speak
CLAUDE.md2 starsChanged 7 months agoMITView on GitHub
ElevenLabs V3 TTS skill for Claude Code. Agents speak aloud via a shared audio queue backed by an HTTP daemon. Set in .env (copy from .env.example) or export in shell: Streaming engine: SPEAK_PORT, SPEAK_PREROLL_MS, SPEAK_RESUME_REWIND_MS and SPEAK_COLLECTOR_WORKERS are parsed with int() at import — an empty value (not an absent one) crashes the daemon at startup. unset them rather than setting them blank. V3 tags in brackets direct voice acting — they're stage directions, not sound effects. Works: emotions ([deadpan],…
- Reads credentials
In this repository2 other files it gives its agents.
- speakSkill
- generate-voice-portraitSkill
The file
We split this CLAUDE.md into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 60
No external deps in say.sh/speak.py — stdlib + curl/afplay/python3 only.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
ElevenLabs V3 TTS skill for Claude Code. Agents speak aloud via a shared audio queue backed by an HTTP daemon.
Running
# Start the daemon (requires uv)
uv run daemon/server.py
# Speak (daemon must be running)
scripts/say.sh "Hello"
scripts/say.sh "Hello" --voice Adam --channel my-agent
# Standalone fallback (no daemon)
python3 scripts/speak.py "Hello" --voice VOICE_ID --syncEnvironment
Set in .env (copy from .env.example) or export in shell:
ELEVENLABS_API_KEY— Required for TTSELEVENLABS_VOICE_ID— Default voice ID (optional)SPEAK_PORT— HTTP port (default: 7865)SPEAK_CACHE_DIR— Audio cache directory (default: ./cache)
Streaming engine:
SPEAK_STREAMING—0disables streaming entirely and restores the legacy fetch-then-play path (kill switch; default1)SPEAK_MODEL— boot-default ElevenLabs model id for single-voice synthesis (default:eleven_v3). Runtime precedence isconfig.json>SPEAK_MODEL>eleven_v3, and every source is validated so the advertised model is always one the hop chain routes; the UIs flip it throughGET/POST /config, which persists to the gitignoredconfig.json. UnderSPEAK_STREAMING=0the conversational model is refused with 409 — the legacy path can only synthesizeeleven_v3.SPEAK_PREROLL_MS— audio decoded before live playback starts (default: 500)SPEAK_RESUME_REWIND_MS— rewind applied on resume so a pause replays rather than skips (default: 1000)SPEAK_LIVE_PLAYER—auto|ffplay|audiotoolbox(default:auto, probed at startup)SPEAK_COLLECTOR_WORKERS— concurrent streaming fetches (default: 8)
SPEAK_PORT, SPEAK_PREROLL_MS, SPEAK_RESUME_REWIND_MS and SPEAK_COLLECTOR_WORKERS
are parsed with int() at import — an empty value (not an absent one) crashes the
daemon at startup. unset them rather than setting them blank.
Architecture
scripts/say.sh— Bash CLI. Parses args, POSTs to daemon. Falls back tospeak.pyif daemon is down.daemon/server.py— Starlette+Uvicorn HTTP server (PEP 723 inline deps). TTS via ElevenLabs API, audio queue withafplay, caching, SSE, dashboard. All queue logic lives here.scripts/speak.py— Standalone fallback. Calls API directly, plays viaafplay, falls back to macOSsay. No queue.dashboard/index.html— Single-file web app. Connects via SSE (/events). Portraits indashboard/portraits/have three frames per voice for lip-sync.voices.json— Voice name/ID/color mappings. Loaded by server and dashboard.cache/— MP3s keyed by history ID for replay. Auto-cleaned after 24h.
Audio Tags
V3 tags in brackets direct voice acting — they're stage directions, not sound effects.
Works: emotions ([deadpan], [conspiratorial]), intensity shifts ([slowly, building intensity] → [suddenly shouting]), character voices ([old timey radio announcer]), singing ([singing softly]), theatrical asides, compound directions ([whispering, conspiratorial]).
Doesn't work: sound effects ([car driving by]), physical states ([out of breath]), volume control ([even quieter]).
Key Design Decisions
- No external deps in say.sh/speak.py — stdlib + curl/afplay/python3 only. Daemon uses starlette+uvicorn via
uv run. - macOS-only —
afinfofor duration,ffmpegfor seeking. Playback has two modes: file mode plays a finished file withafplay; live mode pipes still-arriving audio toffplay(fallbackaudiotoolbox, i.e.ffmpeg -f audiotoolbox) so speech starts before synthesis finishes. The worker picks per entry at the head of the queue. - Single shared queue — all agents enqueue to one AudioQueue. Channel-based filtering prevents overlap.
- SSE, not WebSocket — simpler. Initial state on connect, then incremental events.
- MP3 validation with auto-retry —
_fetch_ttsand_fetch_dialoguevalidate response headers and retry up to 2 times on invalid audio.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

