如何解决Windows语音识别对话
如何在UWP应用程序中使用Windows语音识别进行对话?目前,它只能识别我的声音,而不能识别同一对话中其他讲话者的声音。也许,为此存在另一个API吗?
这是我的原始代码:
public sealed partial class MainPage : Page
{
private SpeechRecognizer speechRecognizer;
public MainPage()
{
this.InitializeComponent();
this.speechRecognizer = new SpeechRecognizer();
Init();
}
private async void Init()
{
//Compile predifined grammar
SpeechRecognitionCompilationResult result = await speechRecognizer.CompileConstraintsAsync();
speechRecognizer.ContinuousRecognitionSession.ResultGenerated += ContinuousRecognitionSession_ResultGenerated;
if (speechRecognizer.State == SpeechRecognizerState.Idle)
{
await speechRecognizer.ContinuousRecognitionSession.StartAsync();
}
}
private async void ContinuousRecognitionSession_ResultGenerated(SpeechContinuousRecognitionSession sender,SpeechContinuousRecognitionResultGeneratedEventArgs args)
{
Console.WriteLine(args.Result.Text);
}
}
解决方法
SpeechRecognizer
不能具体识别人的声音。它将分析当前的输入声音,并通过相应的语法将其转换为文本输出。
因此SpeechRecognizer
的理想对话场景是两个人离麦克风不远,说话清晰,并且只有一个人同时讲话。
SpeechRecognizer
提供的是一种简单的语音识别服务,它没有提供用于区分两个人的声音并分别识别输出的API。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。