Reference documentation
https://docs.azure.cn/zh-cn/cognitive-services/speech-service/speech-synthesis-markup?tabs=csharp
process
- Establish a Websocket connection, send a request, and the bing service performs speech synthesis
(1). Request id, request timestamp, pronunciation role, voice style, text content to be synthesized, and audio stream Format, language type
Parameter documentation: https://docs.azure.cn/zh-cn/cognitive-services/speech-service/speech-synthesis-markup?tabs=csharp
Request request = new Request.Builder()
.url(Constants.EDGE_URL)
.header("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6")
.header("User-Agent", Constants.EDGE_UA)
.addHeader("Origin", Constants.EDGE_ORIGIN)
.build();
(2). Construct request header, request address
Non-public address
EDGE_URL=
"https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4"
Request UA
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55
source
chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold
- Receive and return the synthesized data stream data
- Decode and play using local TTS engine
Open source examples
Android
https://github.com/ag2s20150909/TTS.git
This App software extracts the read aloud function in Microsoft Edge. You can select characters, emotions and other parameters as the speech engine to read aloud.
There is currently no cost to use Edge services. If you use Microsoft Azure Implementation is charged based on the number of words.
The effect is exactly the same as Edge
Open source example for Windows
This software is a PC software. Also uses the read aloud function. After entering text, it can be read aloud according to the set voice, and an audio file of the reading will be generated at the same time
Open source code:
https://gitee.com/LuckyHookin/edge-TTS-record
achieve effect