mcpField
S
speakturbo-tts

speakturbo-tts

github.com/emzod创意与媒体201.0k 次安装36 周前更新
代码仓库

关于 speakturbo-tts

speakturbo-tts 是面向需要语音输出的 Agent 的命令行文本转语音工具。它支持流式播放或保存 WAV 文件,提供 8 种内置语音,并在守护进程已启动时快速响应。

主要功能

  1. 01流式文本转语音播放
  2. 02将语音保存为 WAV 文件
  3. 03提供 8 种内置语音
  4. 04守护进程自动启动和停止

适用场景

  1. 01让 Agent 以语音回应
  2. 02即时收听生成的语音
  3. 03保存语音以供稍后播放

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/emzod/speak-turbo --skill speakturbo-tts

安装后在 Claude Code 中输入/speakturbo-tts确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

LICENSE
package.json
install.sh
README.md
pyproject.toml
.gitignore
AGENTS.md
uv.lock
.github/workflows/
install-test.yml
ci.yml
speakturbo-cli/
Cargo.toml
speakturbo-cli/src/
main.rs
speakturbo/
daemon_streaming.py
__init__.py
cli.py
speakturbo/tests/
test_cli.py
test_daemon.py
__init__.py

详细介绍

speakturbo - 和你的 Claude 对话!

让你的 Agent 能够实时与你语音交流。超快文本转语音,延迟约 90ms,内置 8 种声音。

快速开始

# Play immediately - you should hear "Hello world" through your speakers
speakturbo "Hello world"
# Output: ⚡ 92ms → ▶ 93ms → ✓ 1245ms

# Verify it's working by saving to file
speakturbo "Hello world" -o test.wav
ls -lh test.wav  # Should show ~50-100KB file

输出说明:⚡ = 收到首段音频,▶ = 开始播放,✓ = 完成

首次运行

首次执行需要 2-5 秒,因为守护进程需要启动并将模型加载到内存中。之后的调用从首段声音输出开始只需约 90ms。

# First run (slow - daemon starting)
speakturbo "Starting up"  # ~2-5 seconds

# Second run (fast - daemon already running)
speakturbo "Now I'm fast"  # ~90ms

用法

# Basic - plays immediately (default voice: alba)
speakturbo "Hello world"

# Save to file (no audio playback)
speakturbo "Hello" -o output.wav

# Save to specific file
speakturbo "Goodbye" -o goodbye.wav

# Quiet mode (suppress status messages, still plays audio)
speakturbo "Hello" -q

# List available voices
speakturbo --list-voices

可用声音

声音类型
alba女性(默认)
marius男性
javert男性
jean男性
fantine女性
cosette女性
eponine女性
azelma女性

性能

指标数值
首段声音输出时间约 90ms(守护进程已预热)
首次运行2-5s(守护进程启动)
实时因子速度约快 4 倍
采样率24kHz 单声道

架构

speakturbo (Rust CLI, 2.2MB)
    │
    │ HTTP streaming (port 7125)
    ▼
speakturbo-daemon (Python + pocket-tts)
    │
    │ Model in memory, auto-shutdown after 1hr idle
    ▼
Audio playback (rodio)

文本输入

  • **编码:**UTF-8
  • **文本中的引号:**使用转义:speakturbo "She said \"hello\""
  • **长文本:**支持,会在生成时进行流式输出

输出路径安全

-o 标志仅写入允许列表中的目录。默认情况下,包括:

  • /tmp 和系统临时目录
  • 当前工作目录
  • ~/.speakturbo/

如果需要写入其他位置,请使用 --allow-dir:

speakturbo "Hello" -o /custom/path/audio.wav --allow-dir /custom/path

若要永久允许某个目录,请将其添加到 ~/.speakturbo/config:

mkdir -p ~/.speakturbo && echo "/custom/path" >> ~/.speakturbo/config

配置文件每行列出一个目录。以 # 开头的行是注释。

退出代码

代码含义
0成功(音频已播放/保存)
1错误(守护进程连接失败、参数无效)

适用场景

以下情况请使用 speakturbo:

  • 需要即时音频反馈(约 90ms)
  • 速度比声音种类更重要
  • 内置声音足够使用

以下情况请改用 speak:

  • 需要自定义声音克隆(Morgan Freeman 等) → speak "text" --voice ~/.chatter/voices/morgan_freeman.wav
  • 需要 [laugh]、[sigh] 等情绪标签
  • 音质/声音种类比速度更重要

完整用法请参阅 speak 技能文档。

故障排除

没有音频播放:

# Check daemon is running
curl http://127.0.0.1:7125/health
# Expected: {"status":"ready","voices":["alba","marius",...]}

# Verify by saving to file and playing manually
speakturbo "test" -o /tmp/test.wav
afplay /tmp/test.wav  # macOS
aplay /tmp/test.wav   # Linux

守护进程无法启动:

# Check port availability
lsof -i :7125

# Manually kill and restart
pkill -f "daemon_streaming"
speakturbo "test"  # Auto-restarts daemon

首次运行速度较慢: 这是正常情况。守护进程需要将约 100MB 的模型加载到内存中。之后的调用会很快(约 90ms)。

守护进程管理

守护进程会在首次使用时自动启动,并且空闲 1 小时后自动关闭。

# Check status
curl http://127.0.0.1:7125/health

# Manual stop
pkill -f "daemon_streaming"

# View logs
cat /tmp/speakturbo.log

与 speak 的比较

功能speakturbospeak
首段声音输出时间约 90ms约 4-8s
声音克隆❌✅
情绪标签❌✅
声音内置 8 种自定义 wav 文件
引擎pocket-ttsChatterbox

评论

支持 Markdown