https://github.com/gitstq/voxforge-cli
🎙️ VoxForge-CLI - Lightweight Terminal Multilingual Text-to-Speech Engine | 轻量级终端多语言语音合成引擎
https://github.com/gitstq/voxforge-cli
Last synced: 23 days ago
JSON representation
🎙️ VoxForge-CLI - Lightweight Terminal Multilingual Text-to-Speech Engine | 轻量级终端多语言语音合成引擎
- Host: GitHub
- URL: https://github.com/gitstq/voxforge-cli
- Owner: gitstq
- License: mit
- Created: 2026-06-01T00:13:19.000Z (24 days ago)
- Default Branch: main
- Last Pushed: 2026-06-01T00:14:07.000Z (24 days ago)
- Last Synced: 2026-06-01T02:00:36.306Z (23 days ago)
- Language: Python
- Homepage: https://github.com/gitstq/VoxForge-CLI
- Size: 23.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🎙️ VoxForge-CLI
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
[](https://github.com/gitstq/VoxForge-CLI/stargazers)
**[简体中文](#简体中文) | [繁體中文](#繁體中文) | [English](#english)**
---
**VoxForge-CLI** 是一款轻量级终端多语言语音合成引擎,专为开发者和内容创作者设计。支持多种TTS后端、声音设计、声音克隆、批量处理和流式输出。
### ✨ 核心特性
- 🌍 **多语言支持** — 支持30+种语言,包括中文、英语、日语、韩语等
- 🎨 **声音设计** — 通过自然语言描述创建全新声音,无需参考音频
- 🎛️ **声音克隆** — 从短音频片段克隆任意声音
- 🚀 **多后端支持** — 支持 Edge TTS、OpenAI、VoxCPM 等多种后端
- 📦 **批量处理** — 高效批量文本转语音,支持并行处理
- 🎚️ **精细控制** — 语速、音调、风格等参数可调
- 💾 **声音库管理** — 保存、加载、导入导出声音配置文件
- ⚡ **零依赖核心** — 核心功能无需复杂依赖,开箱即用
### 🎯 解决的痛点
- 传统TTS工具配置复杂,上手门槛高
- 缺乏统一的命令行工具进行批量处理
- 声音参数调整需要反复尝试,效率低下
- 多语言项目需要切换不同工具
### 💡 自研差异化亮点
- **智能声音设计**:通过自然语言描述自动生成声音配置
- **统一CLI接口**:一个命令行工具搞定所有TTS需求
- **中文优化**:针对中文场景深度优化,支持方言
- **配置持久化**:声音配置一键保存复用
---
## 🚀 快速开始
### 环境要求
- Python 3.10 或更高版本
- pip 包管理器
### 安装
```bash
# 使用 pip 安装
pip install voxforge-cli
# 或从源码安装
git clone https://github.com/gitstq/VoxForge-CLI.git
cd VoxForge-CLI
pip install -e .
```
### 快速使用
```bash
# 显示帮助
voxforge --help
# 简单语音合成
voxforge say "你好,世界!"
# 指定语言和语速
voxforge say "Hello, world!" -l en-US -s 1.2
# 从文件读取并输出
voxforge say -f article.txt -o output.wav
# 列出可用声音
voxforge voice list
# 设计新声音
voxforge design "一位温柔的女性声音" --save
```
---
## 📖 详细使用指南
### 基础命令
#### 🗣️ 语音合成 (say)
```bash
# 基础合成
voxforge say "要合成的文本"
# 指定输出文件
voxforge say "保存到文件" -o output.wav
# 从文件读取文本
voxforge say -f input.txt -o output.wav
# 指定后端引擎
voxforge say "使用OpenAI" -b openai
# 调整语速
voxforge say "快速语音" -s 1.5
# 指定语言
voxforge say "日本語テスト" -l ja-JP
```
#### 🎤 声音管理 (voice)
```bash
# 列出所有声音
voxforge voice list
# 筛选声音
voxforge voice list -l zh -g female
# 创建新声音
voxforge voice create my-voice -l zh-CN -g female -s calm
# 查看声音详情
voxforge voice show my-voice
# 删除声音
voxforge voice delete my-voice
```
#### 🎨 声音设计 (design)
```bash
# 从描述设计声音
voxforge design "一位年轻女性,声音温柔甜美"
# 指定目标语言
voxforge design "An elderly man with deep voice" -l en-US
# 保存设计的声音
voxforge design "专业男声" --save -n professional-male
```
#### 🎙️ 声音克隆 (clone)
```bash
# 从参考音频克隆
voxforge clone "要合成的文本" -r reference.wav -o cloned.wav
```
#### 📦 批量处理 (batch)
```bash
# 创建输入文件(每行一段文本)
echo -e "第一句\n第二句\n第三句" > texts.txt
# 批量处理
voxforge batch texts.txt -o ./output
# 并行处理
voxforge batch texts.txt -o ./output --parallel
```
### Python API
```python
from voxforge import TTSEngine, VoiceProfile, VoiceManager
# 初始化引擎
engine = TTSEngine()
# 简单合成
result = engine.synthesize("你好,世界!")
print(f"输出文件: {result.audio_path}")
print(f"时长: {result.duration_seconds}秒")
# 使用自定义声音
voice = VoiceProfile(
name="custom",
language="zh-CN",
gender="female",
style="calm",
speed=1.2
)
result = engine.synthesize("自定义声音测试", voice=voice)
# 声音设计
from voxforge.models import VoiceDesignRequest
request = VoiceDesignRequest(
description="一位活泼开朗的年轻女孩",
language="zh-CN"
)
profile = engine.design_voice(request)
# 批量处理
texts = ["第一句", "第二句", "第三句"]
results = engine.batch_synthesize(texts, output_dir="./output")
# 声音管理
vm = VoiceManager()
vm.create_default_voices() # 创建默认声音
voices = vm.list_voices() # 列出所有声音
```
### 配置说明
```bash
# 查看当前配置
voxforge config
# 环境变量配置
export VOXFORGE_DEFAULT_LANGUAGE=zh-CN
export VOXFORGE_DEFAULT_SPEED=1.0
export VOXFORGE_OUTPUT_DIR=./output
```
---
## 💡 设计思路与迭代规划
### 设计理念
VoxForge-CLI 的设计遵循以下原则:
1. **简洁优先**:命令行界面直观易用,降低学习成本
2. **模块化架构**:核心引擎与后端解耦,易于扩展
3. **配置即代码**:声音配置可序列化,便于版本管理
4. **渐进增强**:基础功能零依赖,高级功能可选安装
### 技术选型
| 组件 | 选择 | 原因 |
|------|------|------|
| CLI框架 | Click | 成熟稳定,支持复杂命令结构 |
| 终端美化 | Rich | 提供丰富的终端输出格式 |
| 数据验证 | Pydantic | 类型安全,自动验证 |
| HTTP客户端 | httpx | 现代异步支持,性能优秀 |
### 后续迭代计划
- [ ] WebUI 界面支持
- [ ] 更多TTS后端集成
- [ ] 实时语音流处理
- [ ] 声音效果后处理
- [ ] 多说话人对话生成
---
## 📦 打包与部署指南
### 本地开发
```bash
# 克隆仓库
git clone https://github.com/gitstq/VoxForge-CLI.git
cd VoxForge-CLI
# 创建虚拟环境
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# 安装开发依赖
pip install -e ".[dev]"
# 运行测试
pytest
# 代码检查
ruff check .
mypy src/
```
### 构建发布
```bash
# 构建 wheel 包
pip install build
python -m build
# 发布到 PyPI
pip install twine
twine upload dist/*
```
### Docker 部署
```dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY . .
RUN pip install --no-cache-dir .
ENTRYPOINT ["voxforge"]
```
---
## 🤝 贡献指南
我们欢迎所有形式的贡献!
### 如何贡献
1. Fork 本仓库
2. 创建功能分支 (`git checkout -b feature/amazing-feature`)
3. 提交更改 (`git commit -m 'feat: 添加新功能'`)
4. 推送到分支 (`git push origin feature/amazing-feature`)
5. 创建 Pull Request
### 提交规范
遵循 [Angular 提交规范](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit):
- `feat:` 新功能
- `fix:` 修复问题
- `docs:` 文档更新
- `refactor:` 代码重构
- `test:` 测试相关
- `chore:` 构建/工具相关
---
## 📄 开源协议
本项目基于 [MIT 协议](LICENSE) 开源,可自由用于商业和个人项目。
---
**灵感来源**:本项目受到 VoxCPM、Edge-TTS 等优秀开源项目的启发,采用完全自研开发,专注于提供轻量级、易用的命令行TTS解决方案。
---
**VoxForge-CLI** 是一款輕量級終端多語言語音合成引擎,專為開發者和內容創作者設計。支援多種TTS後端、聲音設計、聲音複製、批次處理和串流輸出。
### ✨ 核心特性
- 🌍 **多語言支援** — 支援30+種語言,包括中文、英語、日語、韓語等
- 🎨 **聲音設計** — 透過自然語言描述建立全新聲音,無需參考音訊
- 🎛️ **聲音複製** — 從短音訊片段複製任意聲音
- 🚀 **多後端支援** — 支援 Edge TTS、OpenAI、VoxCPM 等多種後端
- 📦 **批次處理** — 高效批次文字轉語音,支援並行處理
- 🎚️ **精細控制** — 語速、音調、風格等參數可調
- 💾 **聲音庫管理** — 儲存、載入、匯入匯出聲音設定檔
- ⚡ **零依賴核心** — 核心功能無需複雜依賴,開箱即用
### 🚀 快速開始
```bash
# 安裝
pip install voxforge-cli
# 簡單語音合成
voxforge say "你好,世界!"
# 指定語言和語速
voxforge say "Hello, world!" -l en-US -s 1.2
# 設計新聲音
voxforge design "一位溫柔的女性聲音" --save
```
### 📖 詳細使用指南
```bash
# 列出可用聲音
voxforge voice list
# 建立自訂聲音
voxforge voice create my-voice -l zh-TW -g female -s calm
# 批次處理
voxforge batch texts.txt -o ./output
# 聲音複製
voxforge clone "要合成的文字" -r reference.wav -o cloned.wav
```
### 📄 開源協議
本專案基於 [MIT 協議](LICENSE) 開源。
---
**VoxForge-CLI** is a lightweight terminal multilingual Text-to-Speech engine designed for developers and content creators. It supports multiple TTS backends, voice design, voice cloning, batch processing, and streaming output.
### ✨ Key Features
- 🌍 **Multilingual Support** — 30+ languages including Chinese, English, Japanese, Korean, etc.
- 🎨 **Voice Design** — Create new voices from natural language descriptions, no reference audio needed
- 🎛️ **Voice Cloning** — Clone any voice from short audio clips
- 🚀 **Multiple Backends** — Support Edge TTS, OpenAI, VoxCPM, and more
- 📦 **Batch Processing** — Efficient batch text-to-speech with parallel support
- 🎚️ **Fine Control** — Adjustable speed, pitch, style parameters
- 💾 **Voice Library** — Save, load, import/export voice profiles
- ⚡ **Zero-Dependency Core** — Core functionality works out of the box
### 🚀 Quick Start
```bash
# Install
pip install voxforge-cli
# Simple synthesis
voxforge say "Hello, world!"
# Specify language and speed
voxforge say "你好,世界!" -l zh-CN -s 1.2
# Design new voice
voxforge design "A gentle female voice" --save
```
### 📖 Usage Guide
```bash
# List available voices
voxforge voice list
# Create custom voice
voxforge voice create my-voice -l en-US -g female -s calm
# Batch processing
voxforge batch texts.txt -o ./output
# Voice cloning
voxforge clone "Text to synthesize" -r reference.wav -o cloned.wav
```
### Python API
```python
from voxforge import TTSEngine, VoiceProfile
# Initialize engine
engine = TTSEngine()
# Simple synthesis
result = engine.synthesize("Hello, world!")
print(f"Output: {result.audio_path}")
# Custom voice
voice = VoiceProfile(
name="custom",
language="en-US",
gender="female",
style="calm",
speed=1.2
)
result = engine.synthesize("Custom voice test", voice=voice)
```
### 📄 License
This project is open-sourced under the [MIT License](LICENSE).
---
**Inspiration**: This project is inspired by excellent open-source projects like VoxCPM and Edge-TTS, developed independently focusing on providing a lightweight, easy-to-use command-line TTS solution.
**Star ⭐ this repo if you find it helpful!**