Skip to main content
Glama
README.md
# Voice Coach — Antigravity MCP App Plugin

[English](#english) | [中文说明](#中文说明)

---

## 中文说明

**Voice Coach** 是一个面向 **Google Antigravity** 的交互式美式英语口语练习 **MCP App 插件**。让你在普通文字对话中即可享受「美式自然人声回复 + 双语字幕卡片 + 一键录制原声纠发音」的完整口语对话体验,无需开启高消耗的实时语音模式。

### 核心特性
- **聊天内嵌双语语音卡片(`speak_bilingual`)**:基于免费的微软 **Edge TTS**(免 API Key),默认美式女声 `en-US-AvaNeural`,支持在卡片上切换 5 种美式人声(Ava / Andrew / Emma / Brian / Jenny)、调节语速(`0.75x / 1.0x / 1.25x`)以及一键隐藏/显示中文字幕。
- **一键原声录音与发音点评**:通过 Windows 原生音频接口(`winmm.dll`,零额外音频依赖)录制本机麦克风,发回清爽的 `🎤 语音消息` 气泡;AI 通过多模态直接听你的原始录音,给出发音、连读、语调和地道表达点评。
- **侧边栏口语工作台(`open_voice_studio`)**:随时录音发送、设置默认美式音色、回放历史语音卡片、一键清空本地缓存。
- **自动滚动清理**:本地录音与 TTS 缓存自动滚动保留最新 **20 条**,避免无限占用硬盘。

### 快速安装(Windows)

前置依赖:**Python 3.10+**(普通用户无需安装 Node.js,仓库已内置打包好的 `ui/app.html`)。

```powershell
git clone https://github.com/baizelore/voice-coach.git
cd voice-coach

# 普通用户安装(复制安装到 ~/.gemini/config/plugins/voice-coach)
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1

# 开发者模式安装(server/main.py 与 ui/app.html 直接从本仓库实时运行)
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1 -DevMode
```

### 本地开发与同步工作流(`-DevMode`)

由于 Antigravity 插件扫描要求 `~/.gemini/config/plugins/voice-coach` 为真实目录,开发者模式下 `.venv`、`data/` 与 `mcp_config.json` 保留在插件安装目录,而 `mcp_config.json` 直接执行本仓库里的 `server/main.py` 并通过 `VOICE_COACH_APP_HTML` 读取本仓库里的 `ui/app.html`:

| 你修改了哪部分代码 | 怎么同步到 Antigravity |
| :--- | :--- |
| 前端界面 `ui-src/` | 运行 `npm --prefix ui-src run build`(或 `.\scripts\sync.ps1 -BuildUI`),重新打开卡片/面板**立即生效,无需重启服务** |
| 后端逻辑 `server/*.py` | 代码直接从本仓库运行,只需在 Antigravity 的 **MCP Servers** 中点一下刷新 `voice-coach_voice-coach`(或运行 `.\scripts\sync.ps1`) |
| 规则/技能/清单 `rules/`、`skills/`、`plugin.json`、`assets/` | 运行 `.\scripts\sync.ps1`,0.5 秒同步到插件目录,下一轮对话生效 |
| 依赖 `requirements.txt` | 运行 `.\scripts\sync.ps1 -InstallDeps` |

---

## English

**Voice Coach** is an interactive **MCP App** plugin for **Google Antigravity** designed for conversational American English practice right inside standard chat turns—without burning real-time voice mode quotas.

### Features
- **Inline Bilingual Voice Cards (`speak_bilingual`)**: Synthesizes natural American English speech via free Microsoft **Edge TTS** (`en-US-AvaNeural` default, switchable between Ava, Andrew, Emma, Brian, and Jenny), with playback speed controls (`0.75x / 1.0x / 1.25x`), toggleable Chinese subtitles, pronunciation/grammar feedback, and key expression chips.
- **One-Click Local Voice Replies**: Uses zero-dependency Windows MCI (`winmm.dll`) microphone recording so Antigravity listens directly to your raw `.wav` voice for authentic pronunciation, rhythm, and intonation coaching, while keeping the chat bubble ultra-clean (`🎤 语音消息`).
- **Voice Coach Studio (`open_voice_studio`)**: Persistent side-pane / sidebar workbench to record replies anytime, persist your default US voice, replay history, and clear cache.
- **Rolling 20-Item Cache**: Automatically retains only the latest 20 recordings and 20 TTS audio files.

### Quick Install (Windows)

Requirements: **Python 3.10+** (Node.js is only needed if you modify `ui-src/`).

```powershell
git clone https://github.com/baizelore/voice-coach.git
cd voice-coach
powershell -ExecutionPolicy Bypass -File .\scripts\install.ps1
```

### Project Structure

```text
voice-coach/
├── plugin.json              # Antigravity plugin manifest
├── mcp_config.example.json  # Template (local mcp_config.json is generated & gitignored)
├── requirements.txt         # Python dependencies (mcp, edge-tts)
├── assets/logo.svg          # Plugin icon
├── rules/AGENTS.md          # Always-on plugin rule for handling voice messages
├── skills/voice-coach/      # Agent skill instructions
├── server/
│   ├── main.py              # MCPServer entry point
│   ├── tts_engine.py        # Edge TTS synthesis & rolling retention
│   └── recorder.py          # Windows MCI mic recorder & rolling retention
├── ui-src/                  # TypeScript + @modelcontextprotocol/ext-apps source
├── ui/app.html              # Bundled single-file MCP App HTML
└── scripts/
    ├── install.ps1          # One-click installer (supports -DevMode and -BuildUI)
    └── sync.ps1             # Dev sync & MCP server reload helper
```

### License
[MIT](LICENSE)