ClawSkills logoClawSkills

Elevenlabs Integration with Openclaw

ClawVox - OpenClaw 的 ElevenLabs 语音工作室。生成语音、转录音频、克隆声音、创建音效等。

介绍

# ClawVox

借助 ClawVox 将您的 OpenClaw 助手转变为专业的语音制作工作室 —— 由 ElevenLabs 提供支持。

## 快速参考

| 操作 | 命令 | 描述 | |--------|---------|-------------| | 语音 | `{baseDir}/scripts/speak.sh 'text'` | 将文本转换为语音 | | 转录 | `{baseDir}/scripts/transcribe.sh audio.mp3` | 语音转文本 | | 克隆 | `{baseDir}/scripts/clone.sh --name "Voice" sample.mp3` | 克隆声音 | | 音效 | `{baseDir}/scripts/sfx.sh "thunder storm"` | 生成音效 | | 声音 | `{baseDir}/scripts/voices.sh list` | 列出可用声音 | | 配音 | `{baseDir}/scripts/dub.sh --target es audio.mp3` | 翻译音频 | | 隔离 | `{baseDir}/scripts/isolate.sh audio.mp3` | 去除背景噪音 |

## 安装设置

1. 从 [elevenlabs.io/app/settings/api-keys](https://elevenlabs.io/app/settings/api-keys) 获取您的 API 密钥 2. 在 `~/.openclaw/openclaw.json` 中配置:

```json5 { skills: { entries: { "clawvox": { apiKey: "YOUR_ELEVENLABS_API_KEY", config: { defaultVoice: "Rachel", defaultModel: "eleven_turbo_v2_5", outputDir: "~/.openclaw/audio" } } } } } ```

或者设置环境变量: ```bash export ELEVENLABS_API_KEY="your_api_key_here" ```

## 语音生成 (TTS)

### 基础文本转语音 ```bash # Quick speak with default voice (Rachel) {baseDir}/scripts/speak.sh 'Hello, I am your personal AI assistant.'

# Specify voice by name {baseDir}/scripts/speak.sh --voice Adam 'Hello from Adam'

# Save to file {baseDir}/scripts/speak.sh --out ~/audio/greeting.mp3 'Welcome to the show'

# Use specific model {baseDir}/scripts/speak.sh --model eleven_multilingual_v2 'Bonjour'

# Adjust voice settings {baseDir}/scripts/speak.sh --stability 0.5 --similarity 0.8 'Expressive speech'

# Adjust speed {baseDir}/scripts/speak.sh --speed 1.2 'Faster speech'

# Use multilingual model for other languages {baseDir}/scripts/speak.sh --model eleven_multilingual_v2 --voice Rachel 'Hola, que tal' {baseDir}/scripts/speak.sh --model eleven_multilingual_v2 --voice Adam 'Guten Tag' ```

### 语音模型

| 模型 | 延迟 | 语言 | 最适用于 | |-------|---------|-----------|----------| | `eleven_flash_v2_5` | ~75ms | 32 | 实时,流式 | | `eleven_turbo_v2_5` | ~250ms | 32 | 平衡质量/速度 | | `eleven_multilingual_v2` | ~500ms | 29 | 长篇内容,最高质量 |

### 可用声音

预设声音:Rachel, Adam, Antoni, Bella, Domi, Elli, Josh, Sam, Callum, Charlie, George, Liam, Matilda, Alice, Bill, Brian, Chris, Daniel, Eric, Jessica, Laura, Lily, River, Roger, Sarah, Will

### 长篇内容 ```bash # Generate audio from text file {baseDir}/scripts/speak.sh --input chapter.txt --voice "George" --out audiobook.mp3 ```

## 语音转文本 (转录)

### 基础转录 ```bash # Transcribe audio file {baseDir}/scripts/transcribe.sh recording.mp3

# Save to file {baseDir}/scripts/transcribe.sh --out transcript.txt audio.mp3

# Transcribe with language hint {baseDir}/scripts/transcribe.sh --language es spanish_audio.mp3

# Include timestamps {baseDir}/scripts/transcribe.sh --timestamps podcast.mp3 ```

### 支持的格式 - MP3, MP4, MPEG, MPGA, M4A, WAV, WebM - 最大文件大小:100MB

## 语音克隆

### 即时语音克隆 ```bash # Clone from single sample (minimum 30 seconds recommended) {baseDir}/scripts/clone.sh --name MyVoice recording.mp3

# Clone with description {baseDir}/scripts/clone.sh --name BusinessVoice \ --description 'Professional male voice' \ sample.mp3

# Clone with labels {baseDir}/scripts/clone.sh --name MyVoice \ --labels '{"gender":"male","age":"adult"}' \ sample.mp3

# Remove background noise during cloning {baseDir}/scripts/clone.sh --name CleanVoice \ --remove-bg-noise \ sample.mp3

# Test cloned voice {baseDir}/scripts/speak.sh --voice MyVoice 'Testing my cloned voice' ```

## 语音库管理

```bash # List all available voices {baseDir}/scripts/voices.sh list

# Get voice details {baseDir}/scripts/voices.sh info --name Rachel {baseDir}/scripts/voices.sh info --id 21m00Tcm4TlvDq8ikWAM

# Search voices (filter output with grep) {baseDir}/scripts/voices.sh list | grep -i "female"

# Filter by category {baseDir}/scripts/voices.sh list --category premade {baseDir}/scripts/voices.sh list --category cloned

# Download voice preview {baseDir}/scripts/voices.sh preview --name Rachel -o preview.mp3

# Delete custom voice {baseDir}/scripts/voices.sh delete --id "voice_id" ```

## 音效

```bash # Generate sound effect {baseDir}/scripts/sfx.sh 'Heavy rain on a tin roof'

# With duration {baseDir}/scripts/sfx.sh --duration 5 'Forest ambiance with birds'

# With prompt influence (higher = more accurate) {baseDir}/scripts/sfx.sh --influence 0.8 'Sci-fi laser gun firing'

# Save to file {baseDir}/scripts/sfx.sh --out effects/thunder.mp3 'Rolling thunder' ```

**注意:** 时长范围为 0.5 到 22 秒(四舍五入至 0.5 秒)

## 语音隔离

```bash # Remove background noise and isolate voice {baseDir}/scripts/isolate.sh noisy_recording.mp3

# Save to specific file {baseDir}/scripts/isolate.sh --out clean_voice.mp3 meeting_recording.mp3

# Don't tag audio events {baseDir}/scripts/isolate.sh --no-audio-events recording.mp3 ```

**要求:** - 最短时长:4.6 秒 - 支持的格式:MP3, WAV, M4A, OGG, FLAC

## 配音 (多语言翻译)

```bash # Dub audio to Spanish {baseDir}/scripts/dub.sh --target es audio.mp3

# Dub with source language specified {baseDir}/scripts/dub.sh --source en --target ja video.mp4

# Check dubbing status {baseDir}/scripts/dub.sh --status --id "dubbing_id"

# Download dubbed audio {baseDir}/scripts/dub.sh --download --id "dubbing_id" --out dubbed.mp3 ```

**支持的语言:** en, es, fr, de, it, pt, pl, hi, ar, zh, ja, ko, nl, ru, tr, vi, sv, da, fi, cs, el, he, id, ms, no, ro, uk, hu, th

## API 使用示例

要进行直接 API 访问,所有脚本底层均使用 curl:

```bash # Direct TTS API call curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/VOICE_ID" \ -H "xi-api-key: $ELEVENLABS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"text": "Hello world", "model_id": "eleven_turbo_v2_5"}' \ --output speech.mp3 ```

## 错误处理

所有脚本都会提供有用的错误消息:

- **401**:身份验证失败 - 请检查您的 API 密钥 - **403**:权限被拒绝 - 您的 API 密钥可能没有权限 - **429**:超过速率限制 - 请稍后再试 - **500/502/503**:ElevenLabs API 问题 - 请稍后再试

## 测试

运行测试套件以验证一切是否正常工作:

```bash {baseDir}/test.sh YOUR_API_KEY ```

或者使用环境变量: ```bash export ELEVENLABS_API_KEY="your_key" {baseDir}/test.sh ```

## 故障排除

### 常见问题

1. **“exec host not allowed (requested gateway)”** - 该技能需要在沙箱环境中运行命令 - 配置 OpenClaw 使用沙箱:`tools.exec.host: "sandbox"` - 或者在您的 OpenClaw 配置中启用沙箱 - 备选方案:为网关主机配置执行批准(参阅 OpenClaw 文档)

2. **包含引号或感叹号的解析错误** - 使用单引号代替双引号:`'Hello world'` 而不是 `"Hello world!"` - 使用双引号时,避免在文本中使用感叹号(`!`) - 对于复杂的文本,使用 `--input` 选项指定文件

3. **“ELEVENLABS_API_KEY not set”** - 确保 `ELEVENLABS_API_KEY` 已设置或在 openclaw.json 中已配置 - 检查 API 密钥长度是否至少为 20 个字符

2. **“jq is required but not installed”** - 安装 jq:`apt-get install jq` (Linux) 或 `brew install jq` (macOS)

3. **“Rate limited”** - 在 elevenlabs.io/app/usage 检查您的 ElevenLabs 计划配额 - 免费版:约 10,000 字符/月

4. **“Voice not found”** - 使用 `{baseDir}/scripts/voices.sh list` 查看可用声音 - 检查声音 ID 是否正确

5. **“Dubbing failed”** - 确保源音频清晰且可听见 - 检查支持的语言代码

6. **“File too large”** - 转录:最大 100MB - 配音:最大 500MB - 语音克隆:每个文件最大 50MB

### 调试模式 ```bash # Enable verbose output DEBUG=1 {baseDir}/scripts/speak.sh 'test'

# Show API request details DEBUG=1 {baseDir}/scripts/transcribe.sh audio.mp3 ```

## 定价说明

ElevenLabs API 定价(近似值): - **Flash v2.5**:~$0.06/min - **Turbo v2.5**:~$0.06/min - **Multilingual v2**:~$0.12/min - **语音克隆**:包含在计划中 - **音效**:~$0.02/次生成 - **转录**:~$0.02/min (Scribe v1)

免费版:约 10,000 字符/月

## 链接

- [ElevenLabs 控制台](https://elevenlabs.io/app) - [API 文档](https://elevenlabs.io/docs) - [语音库](https://elevenlabs.io/voice-library) - [定价](https://elevenlabs.io/pricing)

更多产品