介绍
# MoodCast
将任意文本转化为富有情感表现力的音频,并配有环境音效。MoodCast 分析您的内容,使用 ElevenLabs v3 音频标签添加富有表现力的演绎,并叠加匹配的环境音效。
## 何时使用此技能
当用户想要以下情况时使用 MoodCast: - 听到以自然情感表达的朗读文本 - 创建文章、故事或脚本的音频版本 - 生成带有环境氛围的表现力丰富的配音 - 收听听起来真正引人入胜的晨间简报 - 将枯燥的文本转化为迷人的音频内容
**触发短语:** "read this dramatically", "make this sound good", "create audio for", "moodcast this", "read with emotion", "narrate this"
**斜杠命令:** `/moodcast`
## 核心功能
### 1. 情感感知文本增强
自动分析文本并插入适当的 v3 音频标签: - **情感:** `[excited]`, `[nervous]`, `[angry]`, `[sorrowful]`, `[calm]`, `[happy]` - **演绎:** `[whispers]`, `[shouts]`, `[rushed]`, `[slows down]` - **反应:** `[laughs]`, `[sighs]`, `[gasps]`, `[giggles]`, `[crying]` - **节奏:** `[pause]`, `[breathes]`, `[stammers]`, `[hesitates]`
### 2. 环境音效生成
使用音效 API 创建匹配的背景音频: - 新闻 → 微妙的办公室环境音 - 故事 → 与心境匹配的氛围音效 - 励志 → 振奋人心的背景音 - 恐怖 → 紧张、怪诞的氛围
### 3. 多角色对话
针对对话/脚本,为不同的说话者分配不同的声音,并带有适当的情感演绎。
## 指令
### 快速阅读(单命令) ```bash python3 {baseDir}/scripts/moodcast.py --text "Your text here" ```
### 带环境音效 ```bash python3 {baseDir}/scripts/moodcast.py --text "Your text here" --ambient "coffee shop background noise" ```
### 保存到文件 ```bash python3 {baseDir}/scripts/moodcast.py --text "Your text here" --output story.mp3 ```
### 不同情感 ```bash python3 {baseDir}/scripts/moodcast.py --text "Your text" --mood dramatic python3 {baseDir}/scripts/moodcast.py --text "Your text" --mood calm python3 {baseDir}/scripts/moodcast.py --text "Your text" --mood excited python3 {baseDir}/scripts/moodcast.py --text "Your text" --mood scary ```
### 列出可用语音 ```bash python3 {baseDir}/scripts/moodcast.py --list-voices ```
### 自定义配置 ```bash python3 {baseDir}/scripts/moodcast.py --text "Your text" --voice VOICE_ID --model eleven_v3 --output-format mp3_44100_128 ```
## 情感检测规则
该技能会自动检测并增强:
| 文本模式 | 添加的音频标签 | |-------------|-----------------| | "amazing", "incredible", "wow" | `[excited]` | | "scared", "afraid", "terrified" | `[nervous]` | | "angry", "furious", "hate" | `[angry]` | | "sad", "sorry", "unfortunately" | `[sorrowful]` | | "secret", "quiet", "between us" | `[whispers]` | | "!" 感叹号 | `[excited]` | | "..." 省略号 | `[pause]` | | "haha", "lol" | `[laughs]` | | 疑问句 | 自然的升调 |
## 转换示例
**输入:** ``` Breaking news! Scientists have discovered something incredible. This could change everything we know about the universe... I can't believe it. ```
**增强输出:** ``` [excited] Breaking news! Scientists have discovered something incredible. [pause] This could change everything we know about the universe... [gasps] [whispers] I can't believe it. ```
**输入:** ``` It was a dark night. The old house creaked. Something moved in the shadows... "Who's there?" she whispered. ```
**增强输出:** ``` [slows down] It was a dark night. [pause] The old house creaked. [nervous] Something moved in the shadows... [whispers] "Who's there?" she whispered. ```
## 环境变量
- `ELEVENLABS_API_KEY`(必需)- 您的 ElevenLabs API 密钥 - `MOODCAST_DEFAULT_VOICE`(可选)- 默认语音 ID(默认为 `CwhRBWXzGAHq8TQ4Fs17`) - `MOODCAST_MODEL`(可选)- 默认模型 ID(默认为 `eleven_v3`) - `MOODCAST_OUTPUT_FORMAT`(可选)- 默认输出格式(默认为 `mp3_44100_128`) - `MOODCAST_AUTO_AMBIENT`(可选)- 设置为 `"true"` 以在使用 `--mood` 时自动添加环境音效
**配置优先级:** CLI 参数 > 环境变量 > 硬编码默认值。
## 技术说明
- 使用 ElevenLabs Eleven v3 模型以支持音频标签 - 使用音效 API 生成环境音效(最长 30 秒) - 免费套餐:10,000 积分/月(约 10 分钟音频) - 每个分块最多 2,400 个字符(v3 支持 5,000 个,但为了稳定性我们进行了保守分块) - 音频标签必须小写:例如 `[whispers]` 而非 `[WHISPERS]`
## 获取最佳效果的技巧
1. **戏剧性内容**效果最好 - 如故事、新闻、脚本 2. **较短的片段**(500 字符以内)听起来更自然 3. **结合环境音效**以获得沉浸式体验 4. **Roger 和 Rachel** 语音在 v3 模型下最具表现力
## 致谢
由 [ashutosh887](https://github.com/ashutosh887) 构建 使用 ElevenLabs 文本转语音 v3 + 音效 API 为 #ClawdEleven 黑客马拉松创建