Voice
Feishu Voice Skill
OpenClaw skill plugin for generating voice messages via Feishu using ChatTTS and RVC voice conversion
Install
pip install torch
README
# Feishu Voice Skill
## 飞书语音技能 / 飞书语音技能
> 一款基于 OpenClaw 的飞书语音消息生成技能,融合 ChatTTS 与 RVC 语音转换技术,为您打造温和自然、亲切温暖的声音体验。
> A Feishu (Lark) voice message generation skill for OpenClaw, combining ChatTTS and RVC voice conversion technologies to deliver warm, natural, and friendly voice experiences.
---
## 目录 / Table of Contents
- [仓库信息 / Repository](#仓库信息-repository)
- [项目介绍 / Introduction](#项目介绍-introduction)
- [核心特性 / Features](#核心特性-features)
- [技术架构 / Architecture](#技术架构-architecture)
- [工作流程 / Workflow](#工作流程-workflow)
- [推理流程详解 / Inference Process](#推理流程详解-inference-process)
- [快速开始 / Quick Start](#快速开始-quick-start)
- [使用说明 / Usage](#使用说明-usage)
- [项目结构 / Project Structure](#项目结构-project-structure)
- [开源引用 / Open Source](#开源引用-open-source)
- [免责声明 / Disclaimer](#免责声明-disclaimer)
---
## 仓库信息 / Repository
| 项目 / Item | 信息 / Info |
|-------------|-------------|
| **仓库地址 / URL** | https://github.com/jiuyou-dev/feishu-voice-skill |
| **所有者 / Owner** | jiuyou-dev (九幽实验室) |
| **许可证 / License** | MIT License |
| **开源协议 / Open Source** | ChatTTS (BSD-3-Clause), RVC (MIT) |
---
## 项目介绍 / Introduction
### 中文介绍
**Feishu Voice Skill** 是一款专为 OpenClaw AI 助手设计的飞书语音消息生成技能。它巧妙地结合了两大核心技术:
1. **ChatTTS**(字节跳动开源的高质量语音合成系统)- 负责将文本转换为自然流畅的语音
2. **RVC**(检索式语音转换)- 负责将语音转换为特定音色,保留原始语音的情感和韵律
通过这两者的完美结合,我们能够生成**温和亲切、情感丰富、韵律自然**的语音消息,并通过飞书平台发送给用户。
### English Introduction
**Feishu Voice Skill** is a voice message generation skill designed specifically for the OpenClaw AI assistant. It ingeniously combines two core technologies:
1. **ChatTTS** (ByteDance's open-source high-quality text-to-speech system) - responsible for converting text into natural and fluent speech
2. **RVC** (Retrieval-based Voice Conversion) - responsible for transforming speech to specific timbres while preserving original emotion and prosody
Through the perfect combination of these two technologies, we can generate **warm, friendly, emotionally rich, and natural-sounding** voice messages and send them to users via the Feishu platform.
---
## 核心特性 / Features
### 🎯 主要功能 / Core Functions
| 功能 / Feature | 描述 / Description |
|----------------|-------------------|
| **ChatTTS 语音合成** | 将任意文本转换为自然语音 |
| **RVC 音色转换** | 将 ChatTTS 语音转换为目标音色 |
| **飞书消息发送** | 支持群聊和私聊语音消息发送 |
| **长文本处理** | 自动分段处理超长文本 |
| **数字转换** | 阿拉伯数字自动转换为中文大写 |
| **批量处理** | 支持批量语音生成 |
### 🎙️ 声音特点 / Voice Characteristics
- **温和亲切 / Warm & Friendly** - 音质温暖自然,如同与朋友交谈
- **情感丰富 / Rich Emotion** - 保留文本中的情感表达
- **韵律自然 / Natural Prosody** - 语调起伏自然,听感舒适
- **清晰准确 / Clear & Accurate** - 发音标准,语义传达准确
---
## 技术架构 / Architecture
### 系统架构图 / System Architecture
```
┌─────────────────────────────────────────────────────────────────────┐
│ Feishu Voice Skill │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Text │───▶│ ChatTTS │───▶│ RVC │───▶│ Feishu │ │
│ │ Input │ │ (TTS) │ │ (VC/音色) │ │ (Send) │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ ▼ │
│ 用户输入 文本→语音 音色转换 飞书发送 │
│ User Input Text→Speech Timbre Conv. Message Send │
│ │
└─────────────────────────────────────────────────────────────────────┘
```
### 核心技术栈 / Technology Stack
| 组件 / Component | 技术 / Technology | 版本 / Version | 说明 / Description |
|------------------|------------------|----------------|-------------------|
| TTS 引擎 | ChatTTS | latest | 字节跳动开源高质量语音合成 |
| 声音转换 | RVC | v2 | 检索式语音转换模型 |
| AI 框架 | PyTorch | 2.x | 深度学习框架 |
| 消息平台 | 飞书 API | v1 | 语音消息发送 |
| 运行时 | Python | 3.11 | 程序运行环境 |
| 音频处理 | FFmpeg | latest | 音频格式转换 |
---
## 工作流程 / Workflow
### 完整工作流程 / Complete Workflow
```
Step 1: 用户输入文本
┌─────────────────────────────────────┐
│ 用户输入或 AI 生成文本 │
│ 例: "你好,今天天气真不错呀~" │
└─────────────────────────────────────┘
│
▼
Step 2: ChatTTS 语音合成
┌─────────────────────────────────────┐
│ ChatTTS 将文本转换为语音 │
│ - 自然流畅的语调 │
│ - 保留情感表达 │
│ - 韵律节奏自然 │
└─────────────────────────────────────┘
│
▼
Step 3: 音频预处理
┌─────────────────────────────────────┐
│ - 采样率转换 │
│ - 格式转换 (wav/opus) │
│ - 音频质量优化 │
└─────────────────────────────────────┘
│
▼
Step 4: RVC 音色转换
┌─────────────────────────────────────┐
│ RVC 将语音转换为目标音色 │
│ - 保留原始情感 │
│ - 保留韵律特征 │
│ - 应用目标音色模型 │
└─────────────────────────────────────┘
│
▼
Step 5: 后处理与发送
┌─────────────────────────────────────┐
│ - 音频合并 │
│ - 格式转换为 OPUS (飞书专用) │
│ - 发送至飞书 │
└─────────────────────────────────────┘
│
▼
Step 6: 用户接收
┌─────────────────────────────────────┐
│ 用户在飞书中接收语音消息 │
│ 直接播放,无需下载 │
└─────────────────────────────────────┘
```
---
## 推理流程详解 / Inference Process
### 1. ChatTTS 推理流程 / ChatTTS Inference Process
```
输入文本
│
▼
┌───────────────────────────────┐
│ 1. 文本规范化 (Text Normalization) │
│ - 数字转中文 │
│ - 特殊符号处理 │
│ - 多音字处理 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 2. 语义分析 (Semantic Analysis) │
│ - 句子边界检测 │
│ - 情感标注 │
│ - 韵律预测 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 3. 生成音频参数 │
│ - 梅尔频谱 (Mel-Spectrogram) │
│ - pitch 轮廓 │
│ - 能量曲线 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 4. 声码器合成 (Vocoder) │
│ - HiFiGAN / BigVGAN │
│ - 波形生成 │
└───────────────────────────────┘
│
▼
ChatTTS 语音输出 (raw_audio.wav)
```
### 2. RVC 推理流程 / RVC Inference Process
```
ChatTTS 语音输入
│
▼
┌───────────────────────────────┐
│ 1. 音频预处理 │
│ - 重采样 (根据模型要求) │
│ - 单声道转换 │
│ - 标准化 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 2. F0 提取 (Pitch Extraction) │
│ - RMVPE (推荐) │
│ - Harvest │
│ - Crepe │
│ - 提取基频轮廓 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 3. 特征提取 │
│ - Huberts 特征提取 │
│ - 音频表示学习 │
│ - 1000帧/秒 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 4. 音色转换 │
│ - 加载 RVC 模型权重 │
│ - 特征映射 │
│ - 音色变换 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 5. 波形重建 │
│ - 逆变换 │
│ - 输出目标音色语音 │
└───────────────────────────────┘
│
▼
RVC 转换后语音 (voice_converted.wav)
```
### 3. 飞书发送流程 / Feishu Send Process
```
RVC 转换后语音
│
▼
┌───────────────────────────────┐
│ 1. 格式转换 │
│ - WAV → OPUS (FFmpeg) │
│ - 飞书只支持 OPUS 格式 │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 2. 音频上传 │
│ - 调用飞书 API │
│ - 获取 file_key │
└───────────────────────────────┘
│
▼
┌───────────────────────────────┐
│ 3. 发送语音消息 │
│ - 调用发消息 API │
│ - 指定接收者 │
│ - 支持群聊/私聊 │
└───────────────────────────────┘
│
▼
飞书消息发送成功 ✓
```
---
## 快速开始 / Quick Start
### 环境要求 / Requirements
| 要求 / Requirement | 最低配置 / Minimum | 推荐配置 / Recommended |
|-------------------|-------------------|----------------------|
| Python | 3.11 | 3.11 |
| GPU | GTX 1060 6GB | RTX 3060 12GB+ |
| 内存 / RAM | 8GB | 16GB+ |
| 磁盘空间 / Disk | 10GB | 20GB+ |
| FFmpeg | ✓ 必需 / Required | Latest |
### 安装步骤 / Installation
#### 中文安装
```bash
# 1. 克隆仓库
git clone https://github.com/jiuyou-dev/feishu-voice-skill.git
cd feishu-voice-skill
# 2. 安装 Python 依赖
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -r packages/chatttts/requirements.txt
pip install -r packages/rvc/requirements.txt
# 3. 安装 FFmpeg (Windows)
# 下载 https://ffmpeg.org/download.html
# 或使用: winget install ffmpeg
# 4. 配置飞书 API 密钥
# 在飞书开放平台创建应用并获取 app_id 和 app_secret
```
#### English Installation
```bash
# 1. Clone the repository
git clone https://github.com/jiuyou-dev/feishu-voice-skill.git
cd feishu-voice-skill
# 2. Install Python dependencies
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu128
pip install -r packages/chatttts/requirements.txt
pip install -r packages/rvc/requirements.txt
# 3. Install FFmpeg (Windows)
# Download from https://ffmpeg.org/download.html
# Or use: winget install ffmpeg
# 4. Configure Feishu API credentials
# Create an app on Feishu Open Platform and get app_id and app_secret
```
---
## 使用说明 / Usage
### 基本用法 / Basic Usage
#### 中文使用
```python
# 方式1: 使用联合推理管道 (推荐)
from scripts.chattts_rvc_pipeline import ChatTTSRVCPipeline
pipeline = ChatTTSRVCPipeline()
pipeline.run(
text="你好,今天天气真不错呀~",
output_path="output.wav"
)
# 方式2: 发送飞书语音消息
from scripts.feishu_voice import send_voice_message
send_voice_message(
text="这是测试语音消息",
receive_id="ou_xxxxx", # 飞书用户 open_id
receive_id_type="open_id"
)
```
#### English Usage
```python
# Method 1: Use combined pipeline (Recomm
... (truncated)
voice
Comments
Sign in to leave a comment