edge tts
获取语音列表:
tts接口
wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&Sec-MS-GEC=C14242292B2241ECB17DD93BD17E481FADED759D70DCE83CA526064D9E90420C&Sec-MS-GEC-Version=1-114.0.1823.67&ConnectionId=373cb9fe3c926de352de8ad4c800b24c HTTP/1.1
Host: speech.platform.bing.com
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67
Upgrade: websocket
Origin: chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate, br
Accept-Language: en,zh-CN;q=0.9,zh;q=0.8,en-GB;q=0.7,en-US;q=0.6
Cookie: Imported_MUID=279D5D30479A67B120EC4CF8465A66EC; SRCHD=AF=NOFORM; SRCHUID=V=2&GUID=56CF87A361464E7D97109A4DE5068B80&dmnchg=1; MUID=325A63E135A06AAA171571C234606B8E; _tarLang=default=zh-Hans; _TTSS_OUT=hist=WyJ6aC1IYW5zIl0=; MMCASM=ID=DB36A1CCBCE141C988893F7658931D00; ANON=A=BDF919D5061D7F41CCECB893FFFFFFFF&E=1c5e&W=5; NAP=V=1.9&E=1c04&C=3tftpzkAdHnos47AExrgJwTp6Puwum9ieFNAkA8kcyzaw9FsgBNcHA&W=5; PPLState=1; _UR=QS=0&TQS=0; ABDEF=V=13&ABDV=13&MRNB=1685903928257&MRB=0; USRLOC=HS=1&ELOC=LAT=25.30931282043457|LON=110.4037857055664|N=Lingchuan%20County%2C%20Guangxi%20Zhuang|ELT=2|&CLOC=LAT=25.309329051998866|LON=110.40374008805972|A=733.4464586120832|TS=230701173629|SRC=W; KievRPSSecAuth=FAByBBRaTOJILtFsMkpLVWSG6AN6C/svRwNmAAAEgAAACIcO+OPnB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b=0.0&g=0&cid=&clo=0&v=4&l=2023-06-30T07:00:00.0000000Z&lft=0001-01-01T00:00:00.0000000&aof=0&o=0&p=bingcopilotwaitlist&c=MY00IA&t=8305&s=2023-02-19T09:46:05.9860389+00:00&ts=2023-06-30T17:39:35.7692651+00:00&rwred=0&wls=2&lka=0&lkt=0&TH=&mta=0&e=1FouwS5GVXBVl-SkUiOwiZzt0OE6NrGp9VOEBUZVm8_C_dS7_q_nvq-yiW1bzUP-KIXibyq2kf5HkqCbVM7EGg&A=BDF919D5061D7F41CCECB893FFFFFFFF&dci=0; SUID=A; WLS=C=aa4e6de0bbbb2fd0&N=lizan; _SS=SID=1A9307EC7FD662F3261514AD7E0F63C8; _U=10tbPuGOdzPNMte05ZF-7PujpfTktYWP5vffV0QlYXYElxiZIenSCz69Wr4_EmJH3DEPDT1ewxutXE28f8BucrmvsUMM_dYx23lrl6ia2XHR-B6dZ9TBlLRw-dFn9KqwXmaY6ozCPvW5bvnayy9h5AQpSwxa50xkfSZhxivIgiaQWz6fx0JAdT4mAQSoaumIW1cJZi3gR5nRXxe4x2uJJ5Q
Sec-WebSocket-Key: BgvTFvtUpQzEgl0tGl/iNg==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
发送配置
X-Timestamp:Sun Jul 02 2023 03:46:41 GMT+0800 (中国标准时间)
Content-Type:application/json; charset=utf-8
Path:speech.config
{"context":{"synthesis":{"audio":{"metadataoptions":{"sentenceBoundaryEnabled":"false","wordBoundaryEnabled":"true"},"outputFormat":"webm-24khz-16bit-mono-opus"}}}}
发送文本ssml:
X-RequestId:04b1283ca619378ea55726f80903a6bf
Content-Type:application/ssml+xml
X-Timestamp:Sun Jul 02 2023 03:46:41 GMT+0800 (中国标准时间)Z
Path:ssml
<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xmlns:mstts='https://www.w3.org/2001/mstts' xml:lang='en-US'><voice name='Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)'><prosody pitch='+0Hz' rate ='+0%' volume='+0%'> Prepare for a career in tech by joining GitHub Global Campus. Global Campus will help you get the practical industry knowledge you need by giving you access to industry tools, events, learning resources and a growing student community. </prosody></voice></speak>
回复
1.
X-RequestId:04b1283ca619378ea55726f80903a6bf
Content-Type:application/json; charset=utf-8
Path:turn.start
{
"context": {
"serviceTag": "a11f02b087bc4f7ea6ee4731eebf85f6"
}
}
2.
X-RequestId:04b1283ca619378ea55726f80903a6bf
Content-Type:application/json; charset=utf-8
Path:response
{"context":{"serviceTag":"a11f02b087bc4f7ea6ee4731eebf85f6"},"audio":{"type":"inline","streamId":"575A2A1723424F01BE42AF68534E15B9"}}
3.
X-RequestId:04b1283ca619378ea55726f80903a6bf
Content-Type:application/json; charset=utf-8
Path:audio.metadata
{
"Metadata": [
{
"Type": "WordBoundary",
"Data": {
"Offset": 1000000,
"Duration": 4625000,
"text": {
"Text": "Prepare",
"Length": 7,
"BoundaryType": "WordBoundary"
}
}
}
]
}
4.
X-RequestId:04b1283ca619378ea55726f80903a6bf
Content-Type:application/json; charset=utf-8
Path:audio.metadata
{
"Metadata": [
{
"Type": "WordBoundary",
"Data": {
"Offset": 5750000,
"Duration": 2000000,
"text": {
"Text": "for",
"Length": 3,
"BoundaryType": "WordBoundary"
}
}
}
]
}
以此类推...
5.二进制
[0x00,0x8C]X-RequestId:04b1283ca619378ea55726f80903a6bf
Content-Type:audio/webm; codec=opus
X-StreamId:575A2A1723424F01BE42AF68534E15B9
Path:audio[\r\n]
音频二进制数据...