Skip to content

微软 Edge 语音 API

请求地址

POST 方法:/api/word/edge

请求参数

参数名类型必填说明
contentstring输入路径,可以是文字、txt 路径或文件夹路径
modestring处理模式[三选一],text 文字模式,file 单文件模式、folder 文件夹批处理
voicestring发音人,示例:zh-CN-XiaoxiaoNeural
ratefloat语速,取值范围[0.01~3],默认:1

示例代码

python
import requests

url = 'http://127.0.0.1:5699/api/word/edge'
data = {
    'content': '/path/to/text.txt',
    'mode': 'file',
    'voice': 'zh-CN-XiaoxiaoNeural',
    'rate': 1.00
}
r = requests.post(url, data=data)
print(r.json())
import requests

url = 'http://127.0.0.1:5699/api/word/edge'
data = {
    'content': '/path/to/text.txt',
    'mode': 'file',
    'voice': 'zh-CN-XiaoxiaoNeural',
    'rate': 1.00
}
r = requests.post(url, data=data)
print(r.json())
js
let formData = new FormData();
formData.append("content", "/path/to/text.txt");
formData.append("mode", "file");
formData.append("voice", "zh-CN-XiaoxiaoNeural");
formData.append("rate", 1.0);

fetch("http://127.0.0.1:5699/api/word/edge", {
  method: "POST",
  body: formData,
})
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  });
let formData = new FormData();
formData.append("content", "/path/to/text.txt");
formData.append("mode", "file");
formData.append("voice", "zh-CN-XiaoxiaoNeural");
formData.append("rate", 1.0);

fetch("http://127.0.0.1:5699/api/word/edge", {
  method: "POST",
  body: formData,
})
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  });
js
curl -X POST -F 'content=@/path/to/text.txt' -F 'mode=file' -F 'voice=zh-CN-XiaoxiaoNeural' -F 'rate=1' http://127.0.0.1:5699/api/word/edge
curl -X POST -F 'content=@/path/to/text.txt' -F 'mode=file' -F 'voice=zh-CN-XiaoxiaoNeural' -F 'rate=1' http://127.0.0.1:5699/api/word/edge

响应结果

json
{ "status": "success", "msg": "ok" }
{ "status": "success", "msg": "ok" }

可选发音人

json
[
  {
    "id": 1,
    "value": "zh-CN-XiaoxiaoNeural",
    "label": "晓晓"
  },
  {
    "id": 2,
    "value": "zh-CN-YunxiNeural",
    "label": "云希"
  },
  {
    "id": 3,
    "value": "zh-CN-YunjianNeural",
    "label": "云键"
  },
  {
    "id": 4,
    "value": "zh-CN-XiaoyiNeural",
    "label": "晓伊"
  },
  {
    "id": 5,
    "value": "zh-CN-YunyangNeural",
    "label": "云扬"
  },
  {
    "id": 6,
    "value": "en-US-JennyNeural",
    "label": "Jenny"
  },
  {
    "id": 7,
    "value": "en-GB-SoniaNeural",
    "label": "Sonia"
  },
  {
    "id": 8,
    "value": "en-US-EricNeural",
    "label": "Eric"
  },
  {
    "id": 9,
    "value": "en-US-AnaNeural",
    "label": "Ana"
  },
  {
    "id": 10,
    "value": "zh-HK-HiuGaaiNeural",
    "label": "香港-曉佳"
  },
  {
    "id": 11,
    "value": "zh-HK-HiuMaanNeural",
    "label": "香港-曉曼"
  },
  {
    "id": 12,
    "value": "zh-CN-liaoning-XiaobeiNeural",
    "label": "辽宁-晓北"
  },
  {
    "id": 13,
    "value": "zh-TW-HsiaoChenNeural",
    "label": "台湾-曉臻"
  },
  {
    "id": 14,
    "value": "zh-TW-YunJheNeural",
    "label": "台湾-雲哲"
  },
  {
    "id": 15,
    "value": "zh-CN-shaanxi-XiaoniNeural",
    "label": "陕西-晓妮"
  },
  {
    "id": 16,
    "value": "zh-CN-YunxiaNeural",
    "label": "云夏" // 2023-03-31新增
  }
]
[
  {
    "id": 1,
    "value": "zh-CN-XiaoxiaoNeural",
    "label": "晓晓"
  },
  {
    "id": 2,
    "value": "zh-CN-YunxiNeural",
    "label": "云希"
  },
  {
    "id": 3,
    "value": "zh-CN-YunjianNeural",
    "label": "云键"
  },
  {
    "id": 4,
    "value": "zh-CN-XiaoyiNeural",
    "label": "晓伊"
  },
  {
    "id": 5,
    "value": "zh-CN-YunyangNeural",
    "label": "云扬"
  },
  {
    "id": 6,
    "value": "en-US-JennyNeural",
    "label": "Jenny"
  },
  {
    "id": 7,
    "value": "en-GB-SoniaNeural",
    "label": "Sonia"
  },
  {
    "id": 8,
    "value": "en-US-EricNeural",
    "label": "Eric"
  },
  {
    "id": 9,
    "value": "en-US-AnaNeural",
    "label": "Ana"
  },
  {
    "id": 10,
    "value": "zh-HK-HiuGaaiNeural",
    "label": "香港-曉佳"
  },
  {
    "id": 11,
    "value": "zh-HK-HiuMaanNeural",
    "label": "香港-曉曼"
  },
  {
    "id": 12,
    "value": "zh-CN-liaoning-XiaobeiNeural",
    "label": "辽宁-晓北"
  },
  {
    "id": 13,
    "value": "zh-TW-HsiaoChenNeural",
    "label": "台湾-曉臻"
  },
  {
    "id": 14,
    "value": "zh-TW-YunJheNeural",
    "label": "台湾-雲哲"
  },
  {
    "id": 15,
    "value": "zh-CN-shaanxi-XiaoniNeural",
    "label": "陕西-晓妮"
  },
  {
    "id": 16,
    "value": "zh-CN-YunxiaNeural",
    "label": "云夏" // 2023-03-31新增
  }
]

Powered by 小白兔AI