Skip to content
mctarPublic

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

pocket-tts-mac

Local text-to-speech on macOS via kyutai-labs/pocket-tts, wired into Claude (Cowork, Desktop, Code).

Type any language Claude can read. Hear it spoken back in English, French, German, Italian, Portuguese, or Spanish, on your Mac, with no cloud calls, no API keys, no subscriptions. Translation happens in the conversation; synthesis runs locally through a tiny daemon that watches a folder.

How it works

You speak in Claude → Claude translates to target language
                       → Claude writes a JSON file to ~/Desktop/pocket-tts/
                         → watcher daemon picks it up (~1s)
                           → pocket-tts synthesizes
                             → afplay plays through your Mac speakers

No MCP server, no HTTP, no tunnel, no auth. The bridge from sandboxed chat to host hardware is the filesystem itself — ~/Desktop is a "trusted folder" Claude already has write access to, and a LaunchAgent daemon does the heavy lifting on the host side.

A second integration path (a stdio MCP server) is also included for clients that prefer structured tool calls over file-drop. Use whichever fits the runtime.

Requirements

  • macOS (uses afplay + LaunchAgents)
  • Python 3.10–3.14 (managed automatically by uv)
  • uv — install with brew install uv or curl -LsSf https://astral.sh/uv/install.sh | sh
  • Apple Silicon recommended. Intel may work but speeds are untested.

Install

Clone, then run the installer:

git clone https://github.com/<you>/pocket-tts-mac.git
cd pocket-tts-mac
./setup.sh

By default, this installs into ~/.pocket-tts/. Override with INSTALL_DIR=/some/path ./setup.sh.

The installer:

  1. Creates a uv-managed venv at <install-dir>/.venv/.
  2. Installs pocket-tts (and mcp[cli] if you want the Claude Code MCP variant).
  3. Copies watcher.py and mcp_server.py into the install dir.
  4. Generates ~/Library/LaunchAgents/com.pocket-tts.watcher.plist with absolute paths.
  5. Loads the LaunchAgent so the watcher starts immediately and on every login.

The first synthesis call to a given language downloads ~600 MB – 1 GB of model weights into ~/.cache/huggingface/. One-time cost per language.

Smoke test

After install, drop a JSON file in the queue folder:

echo '{"text":"Hello world.","language":"english"}' > ~/Desktop/pocket-tts/test.json

You should hear "Hello world" within a few seconds (longer on the very first call because the model has to load).

Watch what's happening:

tail -f ~/.pocket-tts/watcher.log

Wire it into Claude

Two integration paths, pick whichever your runtime supports:

Option A — Cowork (file-drop plugin, no MCP)

Best for Claude Cowork's chat surface, which runs in a sandbox that can't spawn host processes but can write files to ~/Desktop.

  1. Build the .plugin file:

    ./build-cowork-plugin.sh

    That writes ~/Desktop/pocket-tts.plugin (override with OUT=/path/x.plugin).

  2. In Cowork: Settings → Plugins → Install from file → pick pocket-tts.plugin. Quit and relaunch Cowork.

  3. Test: ask Cowork "say hello in spanish". Audio should play within a second.

Reliable invocation patterns:

  • /pocket-tts say X in Y (slash command, always triggers)
  • "use pocket-tts to say X in Y"
  • "speak X in Y" / "read X aloud in Y"

Plain "say X in Y" sometimes triggers, sometimes just translates to text — Cowork's auto-trigger heuristic is inconsistent. The slash-command path is the canonical reliable invocation.

Option B — Claude Code (stdio MCP plugin)

Best for Claude Code (CLI) and any MCP client that supports stdio servers running on the host.

  1. The setup.sh script already installs mcp[cli] into the venv (set WITH_MCP=0 to skip).

  2. Generate the .mcp.json with your install dir filled in:

    sed "s|{{INSTALL_DIR}}|$HOME/.pocket-tts|g" \
        plugins/claude-code/.mcp.json.template \
        > plugins/claude-code/.mcp.json
  3. Make it a Claude Code marketplace and install:

    # one-time: register this directory as a personal marketplace
    claude plugin marketplace add ./plugins/claude-code
    claude plugin install pocket-tts@<marketplace-name>

    Or use claude --plugin-dir ./plugins/claude-code for a session-only test.

  4. Restart Claude Code. The MCP tools speak, synthesize_to_wav, list_voices, register_voice become available.

Languages

User input Underlying pocket-tts model Speed (M4 MBA)
english english (latest distilled) ~7× realtime
french french_24l (preview) ~2.5× realtime
german german_24l (preview) ~2.5× realtime
italian italian_24l (preview) ~2.5× realtime
portuguese portuguese_24l (preview) ~2.5× realtime
spanish spanish_24l (preview) ~2.5× realtime

The non-English _24l variants are documented as "preview, not final" by Kyutai — they sound good but are not the final distilled models.

Voices

  • Default (recommended): omit voice from the JSON / tool call. Per-language built-in default. Quality is good.
  • Catalog (26 names): alba, juergen, lola, cosette, marius, estelle, giovanni, rafael, ... — pass any of these as voice. Routes through the cloning model (gated, see below).
  • Saved cloned voice: drop a 30–60s clean reference clip at <install-dir>/voices/<name>.wav and pass "voice":"<name>". Cloning quality on this 100M-param model is rough at the moment; use sparingly.

Voice cloning auth (only needed for non-default voices)

Any non-default voice routes through the gated kyutai/pocket-tts HuggingFace repo. To unlock:

  1. Visit https://huggingface.co/kyutai/pocket-tts and accept the terms.
  2. Generate a token at https://huggingface.co/settings/tokens — a classic Read token works out of the box. Fine-grained tokens need the Read access to public gated repositories permission enabled.
  3. Run ~/.pocket-tts/.venv/bin/hf auth login and paste the token.

Default-voice mode does not require any HuggingFace auth.

Operations

# live progress
tail -f ~/.pocket-tts/watcher.log

# what's queued / processed / failed
ls ~/Desktop/pocket-tts/                # waiting
ls ~/.pocket-tts/queue-done/             # processed successfully
ls ~/.pocket-tts/queue-errors/           # failed (with .error.txt sibling)

# stop / start the watcher
launchctl unload ~/Library/LaunchAgents/com.pocket-tts.watcher.plist
launchctl load   ~/Library/LaunchAgents/com.pocket-tts.watcher.plist

# manual test from the terminal
echo '{"text":"hola","language":"spanish"}' > ~/Desktop/pocket-tts/test.json

# clean up old WAVs
rm ~/.pocket-tts/output/*.wav

Troubleshooting

Watcher not running. launchctl list | grep pocket-tts should show it. If not: launchctl load ~/Library/LaunchAgents/com.pocket-tts.watcher.plist. Check ~/.pocket-tts/watcher.log for errors.

Cowork's Claude just types the translation without dropping a file. The slash-command path is most reliable — try /pocket-tts say X in Y. If that doesn't even invoke the plugin, restart Cowork and check that the plugin shows in Settings → Personal plugins.

No audio plays even though watcher.log shows it processed the file. The audio is going to a different output device, or volume is muted. Try afplay directly on a WAV from ~/.pocket-tts/output/ from a Terminal window — if you hear that but not the watcher's output, the LaunchAgent's audio session is on a different device. Restart the LaunchAgent (launchctl unload && launchctl load) and it'll pick up the current default output.

First call to a language is slow. That's the model loading. Subsequent calls in that language are real-time. If you want to pre-warm: echo '{"text":".","language":"french"}' > ~/Desktop/pocket-tts/warm-fr.json (etc).

Architecture notes

  • Why file-drop instead of MCP? Claude Cowork chat runs in a gVisor sandbox that can't spawn host stdio processes (where the pocket-tts model lives) and only documents HTTP/SSE MCP servers on public URLs. Public-URL MCP for a tool that touches host files is a security headache. The shared filesystem (~/Desktop as a trusted folder) is a much simpler bridge that both surfaces already support, with no auth or networking required. The MCP path is still useful for Claude Code (stdio), so both are shipped.

  • Why a LaunchAgent? The model takes ~1–3s to load and ~1 GB of RAM per language. Spawning a fresh process per request would be unusable. The LaunchAgent keeps the daemon alive, with each language's TTSModel cached in memory across calls.

  • Why the queue dir on ~/Desktop and not somewhere hidden? It needs to be a Cowork-trusted folder. The list of trusted folders is short and ~/Desktop, ~/Downloads, and a few subdirs are typical. Keeping it under ~/Desktop/pocket-tts/ lets the daemon clean up consumed files quickly so it stays effectively empty.

Credits

License

MIT — see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages