From edaa5b9b38e03e8e60e11a4420f1f1a4b3eb3683 Mon Sep 17 00:00:00 2001 From: jinfengli Date: Tue, 13 Apr 2021 09:58:12 +0800 Subject: [PATCH] 语音合成文档 --- tts/语音合成.md | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tts/语音合成.md diff --git "a/tts/\350\257\255\351\237\263\345\220\210\346\210\220.md" "b/tts/\350\257\255\351\237\263\345\220\210\346\210\220.md" new file mode 100644 index 0000000..d20efca --- /dev/null +++ "b/tts/\350\257\255\351\237\263\345\220\210\346\210\220.md" @@ -0,0 +1,101 @@ +- 基本地址 + - 测试环境: http://api-pre.heyqiwu.cn:9663 + +#### 获取不同声音的代号 + +URL: {基本地址}/api/speakers + +METHOD: GET + +Headers: + +| key | value | +| :----------- | :------------: | +| Content-Type | application/json;charset=utf-8 | + +ResponseBody: +```json +{ + "online": { // 表示在线,对外暂时只用这里面的人物声音 + "ProTencent17": { // key表示人物声音的编号 + "name": "腾智美(客服女声(精品))", // 名称 + "sex": "女", // 人物的性别 + "mood": [ + "正常" // 人物声音的情绪 + ], + "third_party": true // 是否是第三方的声音 + } + } +} +``` +Example: +``` +curl --location --request GET 'http://api-pre.heyqiwu.cn:9663/api/speakers' +``` + + +#### 合成语音 + +URL: {基本地址}/api/tts_ls + +METHOD: GET + +Headers: + +| key | value | +| :----------- | :------------: | +| Content-Type | application/json;charset=utf-8 | + +RequestBody: +```json +{ + "botname": "12345678", // bot的帐号 + "text_info_ls": [ + { + "person": "ProTencent17", // 人物声音的编号 + "tone":"正常", // 人物声音的情绪 + "text": "你好,世界!" // 需要合成的文本 + }, + { + "person": "ProTencent17", // 人物声音的编号 + "tone":"正常", // 人物声音的情绪 + "text": "Hello World!" // 需要合成的文本 + } + ] +} +``` + +ResponseBody: +```json +{ + "audio": [ // 返回的顺序和text_info_ls发送顺序一致 + { + "url": "http://cdn-test.heyqiwu.cn/api/audio/cache/12345678/?filename=/12345678/ProTencent17/正常/5082079d92a8ef985f59e001d445ff20.mp3&exist=1" // 合成完成之后的地址 + }, + { + "url": "http://cdn-test.heyqiwu.cn/api/audio/cache/12345678/?filename=/12345678/ProTencent17/正常/ed076287532e86365e841e92bfc50d8c.mp3&exist=1" // 合成完成之后的地址 + } + ], + "status": 200 // 状态码,200表示成功,其他表示失败 +} +``` +Example: +``` +curl --location --request POST 'http://api-pre.heyqiwu.cn:9663/api/tts_ls' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "botname": "12345678", + "text_info_ls": [ + { + "person": "ProTencent17", + "tone":"正常", + "text": "你好,世界!" + }, + { + "person": "ProTencent17", + "tone":"正常", + "text": "Hello World!" + } + ] +}' +``` \ No newline at end of file -- libgit2 0.27.1