克劳德stt
本地、注重隐私的语音转文本 克劳德代码.
对着麦克风说话——你的话直接出现在克劳德密码中。没有复制粘贴,没有云API,没有音频永远不会离开你的设备。
跨平台: macOS、Windows、Linux。
两种模式:
/dictate--静音检测,连续一次,暂停时自动停止。最适合快速消息。- 太平洋电话电报公司 --按住右键选项(macOS)/右键Alt(Windows/Linux)进行录制,释放以停止。所有片段累积为一条消息。准备好后,把所有东西都寄给克劳德。
运作原理
- 使用从麦克风录制音频 PyAudio (PTT)或 sox (
/dictate) - 使用以下方式在本地转录 耳语cpp 随着
base.en模型 - 通过以下方式将成绩单返回给Claude Code 模型上下文协议 服务器
需求
- Node.js>=18
- Python 3
- Claude 代码命令行界面
- 在PATH上低语cpp
macOS```bash
brew install sox whisper-cpp
pip3 install pynput pyaudio pyperclip
### Linux(Debian/Ubuntu)```bash
sudo apt install sox portaudio19-dev python3-pyaudio
pip3 install pynput pyperclip
# Build whisper-cpp from source: https://github.com/ggml-org/whisper.cpp
视窗```powershell
choco install sox
pip install pynput pyaudio pyperclip
Download whisper-cpp from: https://github.com/ggml-org/whisper.cpp/releases
Add the whisper binary to your PATH
## 安装
### macOS/Linux```bash
git clone https://github.com/FaustoS88/claude-stt.git
cd claude-stt
chmod +x install.sh
./install.sh
视窗```powershell
git clone https://github.com/FaustoS88/claude-stt.git
cd claude-stt
.\install.ps1
安装程序将:
1. 检查系统依赖关系(sox、whisper cpp、Python包)
1. 下载 `ggml-base.en.bin` 耳语模式(~142MB)
1. 使用Claude Code注册MCP服务器
1. 安装 `/dictate` 技能
> **首次使用:** 您的操作系统可能会提示您访问麦克风。给予一次,它就会持续下去。
>
> **macOS按键通话:** 终端需要辅助功能权限(系统设置>隐私和安全>辅助功能)才能进行全局密钥捕获。
______________________________________________________________________
## 模式1-- `/dictate` (静音检测)
最适合短的单脉冲消息。说点什么,暂停,完成。
在任何Claude Code会话中:```
/dictate
或者告诉克劳德: “听我说” --它将调用 dictate 工具直接。
录制立即开始,并在约3秒的静音后自动停止(可配置)。
参数
| 参数 | 默认值 | 说明 |
|---|---|---|
max_duration |
30 |
最大录制长度(秒)(5–120) |
silence_duration |
3 |
自动停止前的几秒钟静音(1-10) |
model_path |
~/.claude/mcp-servers/claude-stt/models/ggml-base.en.bin |
GGML模型的路径 |
模式2-PTT(按键通话)
PTT是一种 消息暂存区.想法:
- 保持 正确的选择 (macOS)或 那个是 (Windows/Linux)→ 录制开始
- 发布→ 记录停止、转录、显示在终端中, 已复制到剪贴板
- 阅读它,决定它是好的
- 再次记录→ 添加新片段,更新剪贴板
- 当完整消息准备就绪时→ Cmd+V (macOS)/ Ctrl+V 克劳德代码中的Windows/Linux→ send
没有浪费的API调用。PTT是一个独立的剪贴板工具——它可以与Claude Code、任何浏览器、任何文本字段配合使用。
启动PTT守护进程
在一个 独立终端窗口:```bash
python3 ~/.claude/mcp-servers/claude-stt/ptt.py
### 用法```
Hold Right Option/Alt → recording starts
Release → stops, transcribes, copies to clipboard
Type 'c' + Enter → clear session and clipboard (start fresh)
Type 'q' + Enter → quit
Ctrl+C → quit
终端输出:```
claude-stt PTT — hold Right Option (⌥) to record, release to stop
Type 'c' to clear session | Ctrl+C to exit
Transcript auto-copied to clipboard → Cmd+V to paste
Session: (empty)
● RECORDING — release Right Option (⌥) to stop
✓ "hello, I wanted to ask about the new feature"
Session (copied to clipboard): hello, I wanted to ask about the new feature
● RECORDING — release Right Option (⌥) to stop
✓ "specifically the authentication flow"
Session (copied to clipboard): hello, I wanted to ask about the new feature specifically the authentication flow
### 发送给克劳德
切换到Claude Code,粘贴到输入字段,按Enter键。完成。
### MCP工具(PTT)
|工具|说明|
|---|---|
| `get_session` |读取累积会话。 `clear: true` (默认)读取后删除。 |
| `clear_session` |丢弃会话而不阅读。 |
**共享状态:** `~/.claude/mcp-servers/claude-stt/session.txt` --纯文本,段之间有一个空格。
______________________________________________________________________
## 更改耳语模式
通过编辑交换模型 `DEFAULT_MODEL_PATH` 在 `~/.claude/mcp-servers/claude-stt/index.js`:
|型号|尺寸|速度|最适合|
|---|---|---|---|
| `ggml-tiny.en.bin` |75MB |最快|快速命令|
| `ggml-base.en.bin` |142MB |快速|一般听写 *(默认)* |
| `ggml-small.en.bin` |466MB |中等|更高的准确性/重音|
从下载其他型号 拥抱脸.
## 噪声环境
如果 `/dictate` 从不自动停止(风扇、空调等),增加静音阈值 `~/.claude/mcp-servers/claude-stt/index.js`:```js
const SILENCE_THRESHOLD = "3.0%"; // default: "0.1%"
平台说明
macOS
- PTT要求终端具有 无障碍 权限(系统设置>隐私和安全>辅助功能)
- 首次使用时,每个应用程序都可以访问麦克风
视窗
- PTT按键捕获不需要特殊权限
- 通过以下方式安装sox
choco install sox或从以下网址下载 sox.sourceforge.net - 耳语cpp:从下载预构建的二进制文件 GitHub发布 并添加到PATH
Linux
- PTT需要X11(对pynput的地面支持有限)
- 安装PortAudio:
sudo apt install portaudio19-dev - 对于剪贴板:
xclip或xsel必须安装(sudo apt install xclip)
卸载```bash
claude mcp remove claude-stt --scope user
rm -rf ~/.claude/mcp-servers/claude-stt
rm -rf ~/.claude/skills/dictate
```
隐私
- 音频被捕获、转录并完全丢弃在您的机器上
- MCP服务器或PTT守护进程未发出任何网络请求
- 转录后立即删除临时WAV文件
- 会话文件(
session.txt)当Claude读取时会自动清除 - 耳语模式通过耳语cpp完全离线运行
许可证
麻省理工学院
