Azure语音对文本REST API V3二进制数据
我正在尝试使用Azure语音进行文本服务。在我面临的文档中,使用 v1 api版本:
https://jregion.stt.spech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1
以及基本上的每个链接均适用于 v3 api 。
https:// {endpoint}/speechtotext/v3.0
在此 v1 示例中,您可以轻松地将文件发送为 binary 。
curl --location --request POST \
"https://$region.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=en-US" \
--header "Ocp-Apim-Subscription-Key: $key" \
--header "Content-Type: audio/wav" \
--data-binary $audio_file
但是我无法弄清楚如何提供 WordLevelTimestampSenabled = true
用于获取单词级别时间戳的参数。
另一方面,我尝试使用 v3 API,并且可以轻松地提供 WordLevelTimestampSenabled = true
参数,但是我无法弄清楚如何发送二进制文件数据。
curl -L -X POST 'https://northeurope.api.cognitive.microsoft.com/speechtotext/v3.0/transcriptions' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Ocp-Apim-Subscription-Key: $key' --data-raw '{
"contentUrls": [
"https://url-to-file.dev/test-file.wav"
],
"properties": {
"diarizationEnabled": false,
"wordLevelTimestampsEnabled": true,
"punctuationMode": "DictatedAndAutomatic",
"profanityFilterMode": "Masked"
},
"locale": "pl-PL",
"displayName": "Transcription using default model for pl-PL"
}'
有没有办法传递二进制文件,还可以使用 WordLevelTimestAmpSenabled = true
参数获取Word Level Timestamps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如代码不同,将评论转换为社区Wiki答案,以帮助可能面临类似问题的社区成员, 。
按照,无法直接上传二进制文件。您应该通过
contenturls
属性提供URL。例如:
您可以参考 speeck-to-to-toxt rest api v3.0 , cognitive-services-speech-sdk 和 azure语音识别 - 使用二进制 /十六进制数据,而不是wav文件路径
As suggested by Code Different, converting a comment as a community wiki answer to help community members who might face a similar issue.
As per the documentation, binary file can't be uploaded directly. You should provide URL via
contentUrls
property.For example:
You can refer to Speech-to-text REST API v3.0, cognitive-services-speech-sdk and Azure Speech Recognition - use binary / hexadecimal data instead of WAV file path