Uyghur TTS API Documentation
维吾尔语智能文字转语音 API 系统,提供完整的 RESTful API 接口,支持语音合成、发音人管理、音频下载等功能。
将文本转换为语音,支持维吾尔语、中文等多种语言。
| 参数 | 类型 | 必填 | 说明 | 默认值 |
|---|---|---|---|---|
| text | String | 是 | 要转换的文本内容 | - |
| voice | String | 否 | 发音人: female(女声), male(男声), ug-female, ug-male, 或克隆音色 | female |
| speed | Float | 否 | 语速: 0.5 ~ 2.0 | 1.0 |
| pitch | Int | 否 | 音调: -10 ~ 10 | 0 |
| lang | String | 否 | 语言: ug-CN(维吾尔语), zh-CN, zh-TW, en | ug-CN |
| token | String | 否 | API 密钥 (如已配置) | - |
# 基本调用 curl "http://localhost/api/tts.php?text=ئۇيغۇرچە&voice=female&speed=1" # 指定语言和音调 curl "http://localhost/api/tts.php?text=你好世界&voice=male&speed=1.2&pitch=2&lang=zh-CN" # 使用克隆音色 curl "http://localhost/api/tts.php?text=测试文本&voice=my_voice"
// JavaScript/Fetch const response = await fetch('/api/tts.php?text=' + encodeURIComponent('ئۇيغۇرچە')); // 播放音频 const blob = await response.blob(); const url = URL.createObjectURL(blob); new Audio(url).play(); // 下载音频 const a = document.createElement('a'); a.href = url; a.download = 'tts.mp3'; a.click();
# Python Requests import requests url = "http://localhost/api/tts.php" params = { 'text': 'ئۇيغۇرچە', 'voice': 'female', 'speed': 1, 'lang': 'ug-CN' } response = requests.get(url, params=params) # 保存音频文件 with open('output.mp3', 'wb') as f: f.write(response.content)
获取所有可用的发音人和语言列表。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| token | String | 否 | API 密钥 |
{
"success": true,
"languages": {
"ug-CN": "维吾尔语",
"zh-CN": "中文(简体)"
},
"voices": [
{"code": "female", "name": "女声", "type": "standard"},
{"code": "male", "name": "男声", "type": "standard"}
],
"defaults": {
"voice": "female",
"speed": 1,
"lang": "ug-CN"
}
}
下载合成的音频文件。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | String | 是 | 要转换的文本 |
| voice | String | 否 | 发音人 |
| speed | Float | 否 | 语速 |
| lang | String | 否 | 语言 |
| 代码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 参数错误 |
| 401 | 认证失败 |
| 500 | 服务器错误 |