Skip to main content

Sayback

CI License: MIT Python 3.10+ Status: Alpha

Accessible, code-aware voice reader for AI coding agents — MCP Server, VS Code/Cursor Visual Player & Live Terminal Controller.

راهنمای فارسی (Persian Documentation)


Why Sayback?

Developers dealing with eye strain, low vision, or screen fatigue often struggle to read 20–200 line responses from AI coding agents (Claude Code, Cursor, Kilo Code, Cline, Roo Code, OpenCode).

  • Basic tts-mcp wrappers dump the entire text into one uninterruptible speak() call with no pause, resume, or chunk navigation.
  • Full screen readers (VoiceOver / NVDA) read every bracket, markdown symbol, and code diff aloud.
  • Local neural TTS stacks typically require heavy GPUs or paid API keys.

Sayback is a lightweight, zero-GPU, zero-API-key companion across macOS, Linux, and Windows (v0.1.0 early alpha release).


Key Features

  • Chunked Playback with Persistent Resume: Splits long explanations into natural 1–2 sentence chunks, prefetches upcoming chunks asynchronously to minimize pauses between sentences, and persists progress in state.json. Even hours later—after the background daemon exits to free RAM—sayback resume continues from the beginning of the saved chunk.
  • Code-Aware Sanitizer: Strips fenced code blocks (including 4-backtick and unclosed fences), unified git diff hunks, terminal ANSI escape codes, and raw URLs while preserving inline code identifiers (including generics like Vec<u8>) and shortening long file paths to basenames.
  • 12-Language Auto-Detection (Anchor Language): Detects en, fa, ar, tr, de, fr, es, ru, zh, ja, ko, and hi without ML dependencies, separates Persian from Arabic, supports spaceless CJK chunking, and preserves independent language/voice metadata when multiple messages are queued (enqueue).
  • Non-Blocking MCP Server + Stop Hook: Returns control to your AI agent immediately once queued (warm daemon calls complete quickly; cold-starting the daemon on the first call takes ~0.5–1.5s). Includes a fault-tolerant sayback hook for Claude Code Stop hooks.
  • Single-Instance Local Daemon: Binds strictly to 127.0.0.1 with a per-session random token (compare_digest), serializes concurrent playback commands, prevents overlapping audio across multiple IDE windows, and auto-exits after idle timeout.
  • Visual Player (VS Code / Cursor) & Live Terminal Controller:
    • VS Code / Cursor Extension: Uncluttered Status Bar on the right (expands wide Prev, Pause/Resume 3/12, Next, Replay, Stop controls only while active) + Bottom Panel player with dynamic 12-language voice selector, speed presets, S/M/L/XL scaling, ARIA/screen-reader labels, and automatic RTL/LTR (dir="auto") chunk display.
    • Terminal Live Controller (sayback controller): Zero-dependency keyboard player (Space, ←/→, r, c, s, +/-, q) for macOS, Linux, and Windows terminal workflows.

Privacy & Offline Behavior

Please review how Sayback handles text and network requests before using it on sensitive repositories:

  • Online Neural TTS (edge-tts): By default, Sayback sends the sanitized prose (after stripping code blocks and diffs) over HTTPS/WebSocket to Microsoft Edge's online neural TTS service (no API key or account required; Sayback itself collects zero telemetry).
  • Not a Secret Redactor: The sanitizer is designed for listening comfort, not secret scrubbing. Do not ask Sayback to read .env files, API keys, or confidential credentials aloud.
  • Offline Fallback & Circuit Breaker: If you are offline or edge-tts is unreachable, Sayback opens a 60-second circuit breaker and automatically falls back to your OS speech engine (SAYBACK_TTS_ENGINE=system forces offline-only mode permanently):
    • macOS: Built-in say (supports English and installed system voices; note that macOS does not ship a default built-in Persian/Arabic/CJK voice unless manually downloaded).
    • Windows: Built-in System.Speech (SAPI) via UTF-8 stdin.
    • Linux: espeak-ng or espeak (if installed).
  • Local Disk Storage & Cleanup: Playback state (state.json) and cached audio files (audio/) are stored in private user directories (0700 dirs / 0600 files on POSIX; no message history is retained). Run sayback clear anytime to wipe saved state and cached audio immediately.

Installation

1. Python Core (CLI + MCP Server)

# Recommended (isolated CLI install from PyPI)
pipx install sayback

# Or with uv
uv tool install sayback

# Or inside a virtual environment
pip install sayback

# Or install the latest commit directly from GitHub
pipx install "git+https://github.com/ELLPAA/sayback.git"

Linux Audio Prerequisite: Ensure at least one audio player is installed for MP3/WAV playback (mpv, ffmpeg/ffplay, or mpg123). For offline fallback on Linux, install espeak-ng.

Verify your audio engine and TTS setup:

sayback doctor --live
sayback say "Sayback is ready to read your AI coding answers."

2. VS Code / Cursor Companion Extension

Download sayback-player-0.1.0.vsix from GitHub Releases (or build locally via python scripts/build_vsix.py), then install:

code --install-extension sayback-player-0.1.0.vsix
# Or for Cursor:
cursor --install-extension sayback-player-0.1.0.vsix

Reload the window (Cmd/Ctrl + Shift + P → Developer: Reload Window). Click Sayback in the bottom-right Status Bar to open the visual player in the Bottom Panel alongside Terminal.


Connecting AI Coding Agents

GUI Editor PATH Tip: Editors launched from macOS Dock/Spotlight or Windows Start Menu may not inherit ~/.local/bin in PATH. If your agent reports sayback: command not found, run which sayback (macOS/Linux) or where sayback (Windows) and paste the absolute path into your MCP config.

1. Claude Code (MCP Server or Automatic Stop Hook)

Option A — MCP Server:

claude mcp add sayback -- sayback mcp

Option B — Automatic Stop Hook (~/.claude/settings.json):

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "sayback hook"
          }
        ]
      }
    ]
  }
}

2. Cursor / Cline / Roo Code (mcp.json)

{
  "mcpServers": {
    "sayback": {
      "command": "sayback",
      "args": ["mcp"]
    }
  }
}

3. Kilo Code / OpenCode (kilo.jsonc / opencode.json)

{
  "mcp": {
    "sayback": {
      "type": "local",
      "command": ["sayback", "mcp"],
      "enabled": true
    }
  }
}

Optional: Auto-Read Global Rule for MCP Clients

MCP registration exposes speak and control tools, but unlike Claude Code's Stop hook, clients such as Cursor, Kilo Code, Cline, Roo Code, and OpenCode only call speak automatically if instructed. Add this one-line rule to your agent's global/custom instructions whenever you want automatic spoken answers:

After answering an explanation or analysis question, call the `sayback` MCP `speak` tool once with your plain-language explanation (or a concise `spoken_summary`) so I can listen hands-free.

Exposed MCP Tools:

  • speak(text, spoken_summary="", mode="replace"|"enqueue", voice="", rate="") — Non-blocking chunked speech playback.
  • control(action="pause"|"resume"|"toggle"|"stop"|"next"|"prev"|"replay"|"repeat"|"status"|"clear") — Playback control directly from voice/text prompts.

Live Terminal Controller (Outside VS Code)

Working in Claude Code, OpenCode, or any terminal workflow? Run:

sayback controller
# Alias: sayback ui
Key Action
Space / p Play / Pause (resumes from the start of the saved chunk)
← / h / b Previous chunk
→ / l / n Next chunk
r Replay entire last message from chunk 1
c Repeat current chunk
s Stop playback
+ / - Increase / decrease speech speed
q / Esc Quit controller (playback continues in background)

Built-In 12-Language Neural Voices

Sayback auto-detects the language by default (voice="auto"), or you can lock any voice via the VS Code dropdown or sayback prefs --voice <alias|id>:

Code Language Default (Male) Female
en English en-US-AndrewNeural (andrew) en-US-AriaNeural (aria)
fa Persian (Farsi) fa-IR-FaridNeural (farid) fa-IR-DilaraNeural (dilara)
ar Arabic ar-SA-HamedNeural (hamed) ar-EG-SalmaNeural (salma)
tr Turkish tr-TR-AhmetNeural (ahmet) tr-TR-EmelNeural (emel)
de German de-DE-ConradNeural (conrad) de-DE-KatjaNeural (katja)
fr French fr-FR-HenriNeural (henri) fr-FR-DeniseNeural (denise)
es Spanish es-ES-AlvaroNeural (alvaro) es-ES-ElviraNeural (elvira)
ru Russian ru-RU-DmitryNeural (dmitry) ru-RU-SvetlanaNeural (svetlana)
zh Chinese zh-CN-YunxiNeural (yunxi) zh-CN-XiaoxiaoNeural (xiaoxiao)
ja Japanese ja-JP-KeitaNeural (keita) ja-JP-NanamiNeural (nanami)
ko Korean ko-KR-InJoonNeural (injoon) ko-KR-SunHiNeural (sunhi)
hi Hindi hi-IN-MadhurNeural (madhur) hi-IN-SwaraNeural (swara)

CLI Quick Reference

sayback say "Hello world"        # Speak text (or pipe via stdin; use -- before text starting with -)
sayback toggle                   # Pause / resume from saved chunk
sayback prev | next              # Jump backward / forward one chunk
sayback replay | repeat          # Replay message from chunk 1 / repeat current chunk
sayback stop                     # Stop playback
sayback status                   # Show playback state and chunk progress
sayback clear                    # Wipe saved state.json and cached audio files
sayback prefs --rate +10%        # Save default speed
sayback prefs --voice auto       # Reset voice to 12-language auto-detect
sayback controller               # Open live keyboard controller
sayback doctor --live            # Run diagnostics + live synthesis check

Platform Support Status (v0.1.0 Alpha)

Platform Audio Playback Offline Fallback Verification Status
macOS Built-in afplay Built-in say (Latin/installed voices) Live-verified on macOS + CI
Linux mpv / ffplay / mpg123 / cvlc (MP3) + paplay/aplay (WAV) espeak-ng / espeak Automated CI matrix (Python 3.10–3.13); live desktop feedback welcome
Windows Built-in winmm MCI (mpegvideo/waveaudio) Built-in System.Speech Automated CI matrix (Python 3.10–3.13); live desktop feedback welcome

License

MIT License — see LICENSE.

Metadata

Release files for sayback 0.1.0

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

Source distribution (sdist)

Source distribution for sayback 0.1.0
File Size Uploaded Provenance Actions
sayback-0.1.0.tar.gz 51.7 kB Without provenance Details for sayback-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sayback 0.1.0
File Interpreter ABI Platform Actions
sayback-0.1.0-py3-none-any.whl Python 3 none any Details for sayback-0.1.0-py3-none-any.whl

Total release size: 93.3 kB

Release files / sayback-0.1.0.tar.gz

Download URL sayback-0.1.0.tar.gz
Size 51.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3fe29880d30e713cb3a1a52af95d2604ad8c0afd8d7f1a627742d1a5298e6e2c
BLAKE2b-256 checksum
How to use checksums
b95c50cb1e4d52a028874865345924168233769a6249e5cd29003542849013aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Release files / sayback-0.1.0-py3-none-any.whl

Download URL sayback-0.1.0-py3-none-any.whl
Size 41.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39bdec337865e858ebda6e7b4c8197774ddf9f2325fb2ce18bc91a5c8932c8b0
BLAKE2b-256 checksum
How to use checksums
8061445f98da4d3bf2a5a5664dfd4195f12aa703601946cd82bebb6a65980fec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.17

Security for sayback 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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