新的Microsoft语音服务WebSocket API的终结点是什么? [英] What are the endpoints for the new Microsoft speech service WebSocket APIs?

查看:81
本文介绍了新的Microsoft语音服务WebSocket API的终结点是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用新的MS Speech Translation API,但是我正在使用Go,所以没有SDK.我为先前的Translator Speech API提供了WebSockets实现,因此原始WebSocket没问题.

I want to use the new MS Speech Translation API, but I am working with Go so there is no SDK. I have a WebSockets implementation for the previous Translator Speech API, so raw WebSocket are no issue.

文档指出它正在使用WebSockets,但是我无法在文档中找到端点.有谁知道WS端点及其路径/标头参数是什么?

The documentation states that it is using WebSockets, but I was unable to find the endpoints in the documentation. Does anyone know what are the WS endpoints and their path/header parameters?

文档也说: 如果您已经具有通过WebSocket使用Bing Speech或Translator Speech的代码,则可以对其进行更新以使用Speech服务.WebSocket协议兼容,只是端点不同." 但是缺少新端点.

The documentation also says: "If you already have code that uses Bing Speech or Translator Speech via WebSockets, you can update it to use the Speech service. The WebSocket protocols are compatible, only the endpoints are different." But the new endpoints are missing.

推荐答案

深入研究客户端SDK的二进制文件后,我发现Speech Translate API为wss://<REGION>.s2s.speech.microsoft.com/speech/translation/cognitiveservices/v1

After digging into the binaries of client SDKs I have found the Speech Translate API to be wss://<REGION>.s2s.speech.microsoft.com/speech/translation/cognitiveservices/v1

另一个问题是,尽管文档说的如此,WebSocket协议还是不兼容.好消息是,经过实验,我发现新的语音翻译WS API使用与旧

Another problem is that the WebSocket protocol is NOT compatible despite the documentation says so. Good thing is that after experiments I have found out that the new Speech Translation WS API uses the same protocol as the old Bing Speech WS API, except for URL query parameters. The Bing Speech API has a language parameter and the Speech Translate preview API has from, to, voice and features. The from and to work as expected, you can even send more languages in to (comma separated and the TTS is missing). I have not tried the voice. The features looks like doing nothing and there are always partial results, timing info and TTS.

响应也有所不同,但与Bing Speech类似.它们具有标题,并且有多个不同的JSON.只需观察原始字符串即可.

The responses are also different, but similar to Bing Speech. They have headers and there are multiple different JSONs. Just observe the raw strings.

这是预览API,可以随时更改.

As this is a preview API it can change at any time.

这篇关于新的Microsoft语音服务WebSocket API的终结点是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆