Files
speech-tts/README.md
2026-03-28 20:12:54 +08:00

81 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MiniMax TTS 文字转语音工具
> 基于 MiniMax API 的文字转语音 Web 界面,单 HTML 文件,开箱即用。
**在线地址(需在有网络的环境下访问):** `http://10.0.10.110:8197/speech-t2a.html`
---
## 功能特性
- 🌐 支持 MiniMax 全部 TTS 模型speech-2.8-hd、speech-02-hd 等)
- 🔄 支持 hex 音频流实时播放(自动解码)
- 📦 支持下载为 .wav 文件
- ⚙️ 实时调节语速
- 🎯 自动携带认证头
---
## 快速使用
### 1. 直接打开
在浏览器访问:
```
http://10.0.10.110:8197/speech-t2a.html
```
### 2. 本地部署Python
```bash
cd /path/to/speech-t2a
python3 -m http.server 8197
# 访问 http://localhost:8197/speech-t2a.html
```
### 3. 本地部署Nginx
```nginx
server {
listen 8197;
root /path/to/speech-t2a;
index speech-t2a.html;
location / {
try_files $uri $uri/ =404;
}
}
```
---
## API 说明
- **端点:** `POST https://api.minimaxi.com/v1/t2a_v2`
- **备用:** `POST https://api-bj.minimaxi.com/v1/t2a_v2`
- **认证:** `Authorization: Bearer <API_KEY>`
- **返回格式:** hex 编码的音频数据(非 base64
---
## 模型列表
| 模型 | 说明 |
|------|------|
| `speech-2.8-hd` | 高清音质(推荐) |
| `speech-2.6-hd` | 高清音质 |
| `speech-2.8-turbo` | 快速生成 |
| `speech-2.6-turbo` | 快速生成 |
| `speech-02-hd` | 克隆音质 |
| `speech-02-turbo` | 克隆快速 |
---
## 已知问题
- 音频数据为 hex 编码,需用 `parseInt(hex.substr(i*2, 2), 16)` 解码,不能用 `atob()`
- fetch 的 Authorization header 必须是纯 ASCIIAPI Key 中不能有非 ISO-8859-1 字符
- 跨域音频无法使用 Web Audio API 分析器
---
## 截图
![MiniMax TTS](screenshot.png)