如何在C#中使用azure说话人识别API [英] How can I use azure speaker recognition API in C#

查看:95
本文介绍了如何在C#中使用azure说话人识别API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。我是一名学生用c#做一个与语音相关的项目。



我已经使用了Azure Bing Speech API和Google Cloud Speech API来将人们的声音作为文本。



但是我还需要Azure Speaker Recognition API来识别和验证使用语音的个别发言者。



然而,那里关于此API的信息并不多,即使Google Searching也是如此。而Azure网站(特别是使用包含用户语音的wav文件来识别和验证发言人的部分)非常简单..

所以我不知道如何加载wav文件以识别和验证发言人c#代码。



您是否使用过Azure Speaker Recognition API?



请。帮助我。



我尝试过:



以下为样本Azure网站上的代码。

https://westus.dev.cognitive.microsoft.com/docs/services/563309b6778daf02acc0a508/operations/5645c725ca73070ee8845bd6



static async void MakeRequest()

{

var client = new HttpClient();

var queryString = HttpUtility.ParseQueryString(string .Empty);



//请求标题

client.DefaultRequestHeaders.Add(Ocp-Apim-Subscription-Key,订阅-key);

//请求参数

queryString [shortAudio] =true;

var uri =https: //westus.api.cognitive.microsoft.com/spid/v1.0/identify?identificationProfileIds={identificationProfileIds}& + queryString;



HttpResponseMessage回复;



//申请团体

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);



}



}

解决方案

有你在下面查了

探索微软语音API - Les articles des consultants et experts infeeny [ ^ ]


使用其他内容。微软没有这方面的代码,我相信这是一个死胡同。我一直在寻找一个好的例子3年,但没有用。



也许试试AWS。 Alexa推翻了MS,Apple和Google的所有产品。 AWS必须拥有更好的API。我现在正在检查这个。


我怀疑你遇到问题的一点是,你似乎认为{body}部分字面意思是你放入的内容你应该在这里编码的是你要传输到API的实际音频。不要忘记正确设置参数,例如标识配置文件,代码样本不打算按原样使用。


Hi . I am a student doing a voice-related project with c#.

I already used Azure Bing Speech API and Google Cloud Speech API to get people's voice as text.

But I also need Azure Speaker Recognition API to identify and verify individual speaker using voice.

However, there aren't many information about this API even though Google Searching. And Azure site(especially, part that identify and verify speaker using wav file containing the user's voice) is so simple..
so I can't know how to load wav file to identify and verify speaker in c# code.

Have you used the Azure Speaker Recognition API?

Please. Help me.

What I have tried:

following is sample code on the Azure Site.
https://westus.dev.cognitive.microsoft.com/docs/services/563309b6778daf02acc0a508/operations/5645c725ca73070ee8845bd6

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);

}

}

解决方案

Have you checked below
Exploring Microsoft Speech APIs – Les articles des consultants et experts Infeeny[^]


Use something else. Microsoft has no code for this and I believe it is a dead end. I have been looking for a good example for 3 years, to no avail.

Maybe try AWS. The Alexa has bulldozed anything from MS, Apple, and Google. AWS has got to have MUCH better APIs. I am checking this right now.


I suspect the bit you're having the problem with is the fact that you seem to think that the {body} part literally means that's what you put in. What you should be encoding here is the actual audio that you want to transfer over to the API. Don't forget to properly set the parameters such as the identification profile, the code sample there isn't meant to be used "as is".


这篇关于如何在C#中使用azure说话人识别API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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