我是一名学生,正在使用C#做一个与语音相关的项目。
我已经使用Azure Bing Speech API和Google Cloud Speech API来获取人们的语音文本。
但我还需要Azure Speaker Recognition API来识别和验证使用语音的单个扬声器。
然而,即使在谷歌上搜索,也没有太多关于这个API的信息。Azure站点(特别是使用包含用户声音的wav文件来识别和验证说话者的部分)非常简单……
我不知道如何在C#代码中加载wav文件来识别和验证扬声器。
如何使用Azure Speaker Recognition API执行此操作?
我尝试过的:
以下是Azure Site上的示例代码。
static async void MakeRequest()
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "subscription-key");
// Request parameters
queryString["shortAudio"] = "true";
var uri = "https://westus.api.cognitive.microsoft.com/spid/v1.0/identify?identificationProfileIds={identificationProfileIds}&" + queryString;
HttpResponseMessage response;
// Request body
byte[] byteData = Encoding.UTF8.GetBytes("{body}");
using (var content = new ByteArrayContent(byteData))
{
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
response = await client.PostAsync(uri, content);
}
}发布于 2018-01-12 01:23:11
对于Azure站点上的代码片段,您始终需要替换表单{something}的占位符,因此在您的示例中,您需要为identificationProfileIds和body填写适当的值。此外,content-type需要是application/octet-stream或multipart/form-data,而不是application/json。
通过使用预先构建的客户端SDK,您将节省大量的输入工作。您还可以查看该软件开发工具包的源代码,例如IdentifyAsync,了解HTTP请求是如何构造的。
https://stackoverflow.com/questions/48211436
复制相似问题