ClawSkills logoClawSkills

Inworld TTS

通过 Inworld.ai API 进行文本转语音。在从文本生成语音音频、创建口语响应或将文本转换为 MP3/音频文件时使用。支持多种

介绍

# Inworld TTS

使用 Inworld.ai 的 TTS API 从文本生成语音音频。

## 设置

1. 从 https://platform.inworld.ai 获取 API 密钥 2. 生成具有“Voices: Read”权限的密钥 3. 复制“Basic (Base64)”密钥 4. 设置环境变量:

```bash export INWORLD_API_KEY="your-base64-key-here" ```

为了持久化,添加到 `~/.bashrc` 或 `~/.clawdbot/.env`。

## 安装

```bash # Copy skill to your skills directory cp -r inworld-tts /path/to/your/skills/

# Make script executable chmod +x /path/to/your/skills/inworld-tts/scripts/tts.sh

# Optional: symlink for global access ln -sf /path/to/your/skills/inworld-tts/scripts/tts.sh /usr/local/bin/inworld-tts ```

## 用法

```bash # Basic ./scripts/tts.sh "Hello world" output.mp3

# With options ./scripts/tts.sh "Hello world" output.mp3 --voice Dennis --rate 1.2

# Streaming (for text >4000 chars) ./scripts/tts.sh "Very long text..." output.mp3 --stream ```

## 选项

| 选项 | 默认值 | 描述 | |--------|---------|-------------| | `--voice` | Dennis | 语音 ID | | `--rate` | 1.0 | 语速 (0.5-2.0) | | `--temp` | 1.1 | 温度 (0.1-2.0) | | `--model` | inworld-tts-1.5-max | 模型 ID | | `--stream` | false | 使用流式端点 |

## API 参考

| 端点 | 用途 | |----------|-----| | `POST https://api.inworld.ai/tts/v1/voice` | 标准合成 | | `POST https://api.inworld.ai/tts/v1/voice:stream` | 长文本流式处理 |

## 要求

- `curl` - HTTP 请求 - `jq` - JSON 处理 - `base64` - 解码音频

## 示例

```bash # Quick test export INWORLD_API_KEY="aXM2..." ./scripts/tts.sh "Testing one two three" test.mp3 mpv test.mp3 # or any audio player

# Different voice and speed ./scripts/tts.sh "Slow and steady" slow.mp3 --rate 0.8

# Fast-paced narration ./scripts/tts.sh "Breaking news!" fast.mp3 --rate 1.5 ```

## 故障排除

**“INWORLD_API_KEY not set”** - 在运行前导出环境变量。

**输出文件为空** - 检查 API 密钥是否有效且具有“Voices: Read”权限。

**流式传输问题** - 确保 `jq` 支持 `--unbuffered` 标志。

## 链接

- Inworld Platform: https://platform.inworld.ai - API Examples: https://github.com/inworld-ai/inworld-api-examples

更多产品