SpeechRecognizer无法正常工作,COMException:未注册类/UWP App Windows IoT(10.0.10586)和Visual Studio 2015更新1 [英] SpeechRecognizer not work, COMException: Class not registered/ UWP App Windows IoT (10.0.10586) and Visual Studio 2015 Update 1

查看:229
本文介绍了SpeechRecognizer无法正常工作,COMException:未注册类/UWP App Windows IoT(10.0.10586)和Visual Studio 2015更新1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我安装Windows IoT(10.0.10586)和Visual Studio 2015 Update 1之后,当我在Raspberry Pi 2上的Universal App(Windows IoT 10.0.10586)中使用SpeechRecognizer时,出现COM-Exception.

After I have installed Windows IoT (10.0.10586) and Visual Studio 2015 with Update 1, I got COM-Exception when I use the SpeechRecognizer in Universal App on my Raspberry Pi 2 (with Windows IoT 10.0.10586).

如果我在Windows 10上运行SpeechRecognizer UWP App,它可以正常工作,则COM-Exception仅在Windows IoT(10.0.10586)中发生.对于较旧版本的Windows IoT和Visual Studio 2015(不带Update 1),它也可以正常工作.

If I run the SpeechRecognizer UWP App on Windows 10 it works without any problems, the COM-Exception occurs only in Windows IoT (10.0.10586). With older version of Windows IoT and Visual Studio 2015 without Update 1 it works, too.

有人可以解决这个问题吗?

Has anyone a solution for the problem?

var speechRecognizer = new SpeechRecognizer();
var constraint = new SpeechRecognitionTopicConstraint(SpeechRecognitionScenario.Dictation, "dictation");
speechRecognizer.Constraints.Add(constraint);
await speechRecognizer.CompileConstraintsAsync();

//This line throw exception:
//Exception thrown: 'System.Runtime.InteropServices.COMException' in App.exe
//WinRT information: Class not registered
//Operation not supported.Unknown error: 0x80070057.
var result = await speechRecognizer.RecognizeWithUIAsync();

要获得示例工作,请在Package.appxmainifest中启用以下功能:

To get the sample work enable the following capabilities in the Package.appxmainifest:

Internet(客户端)和麦克风

Internet (Client) and Microphone

编辑

就像埃里克·布朗(Eric Brown)所说,RecognizeWithUIAsync似乎不适用于Windows IoT(我记得不正确,似乎我从未使用过RecognizeWithUIAsync,但我知道SpeechRecognizer过去可以工作).

Like Eric Brown said RecognizeWithUIAsync seems not to work with Windows IoT (I rememberd not correctly, it seems to be I never used RecognizeWithUIAsync but I know SpeechRecognizer works in past).

但是RecognizeAsync也不适用于我.没有引发任何异常,但是RecognizeAsync不等待语音,它直接返回了SpeechRecognitionResult-object,该对象的属性Confidence被拒绝,Status为Success,但语音文本始终为空字符串.它适用于Windows 10,但不适用于Windows IoT.

But RecognizeAsync does not work for me, too. No Exception is thrown, but RecognizeAsync not wait for speech, it directly returns an SpeechRecognitionResult-object where property Confidence is Rejected and Status is Success, but spoken Text is always an empty string. It works on Windows 10, but not on Windows IoT.

有没有人知道为什么没有检测到语音/不会返回口语?

Has anyone an idea why no speech is detected/ the spoken words not will be returned?

var speechRecognizer = new SpeechRecognizer();
var constraint = new SpeechRecognitionTopicConstraint(SpeechRecognitionScenario.Dictation, "dictation");
speechRecognizer.Constraints.Add(constraint);
await speechRecognizer.CompileConstraintsAsync();
while (true)
{
    var result = await speechRecognizer.RecognizeAsync();
    Debug.WriteLine(!string.IsNullOrEmpty(result.Text) ? result.Text : "No speech in result.");
}

要获得示例工作,请在Package.appxmainifest中启用以下功能:

To get the sample work enable the following capabilities in the Package.appxmainifest:

Internet(客户端)和麦克风

Internet (Client) and Microphone

推荐答案

最终使SpeechRecognizer可以与Windows IoT 10.0.10586和Visual Studio 2015 Update 1一起使用.

Finally got SpeechRecognizer to work with Windows IoT 10.0.10586 and Visual Studio 2015 Update 1.

解决方案:使用与Windows IoT 10.0.10586完全兼容的麦克风.我使用的是Microsoft LifeCam HD-3000(附带一个麦克风).

SpeechRecognizer现在可以通过语法文件(定义用户可以说的文件)和听写(言论自由)与ContinuousRecognitionSession和RecognizeAsync一起使用. RecognizeWithUIAsync无法正常工作,也许永远不会正常工作(请参见Eric Browns答案).

SpeechRecognizer now working with ContinuousRecognitionSession and RecognizeAsync with a grammer file (file that defines what user can say) and with dictation (free speech). RecognizeWithUIAsync not work and maybe never will work (see Eric Browns answer).

注意:认为麦克风可以在任何其他应用程序中使用也必须与SpeechRecognizer一起使用是错误的.我有一个可以与简单的录音机应用程序一起使用的麦克风,但不适用于SpeechRecognizer.还请注意,在较旧的Windows IoT版本中与SpeechRecognizer一起使用的麦克风不一定总是与Windows IoT 10.0.10586中的SpeechRecognizer一起使用.

Note: It is a mistake to believe that if a microphone works in any other app, it have to work with SpeechRecognizer, too. I have a microphone that works with a simple audio recorder app, but not works with the SpeechRecognizer. Note also that microphones that have worked with SpeechRecognizer in older Windows IoT versions not always have to work with SpeechRecognizer in Windows IoT 10.0.10586.

使用网络摄像头作为麦克风真的不是很好.如果某人拥有可与SpeechRecognizer和Windows IoT 10.0.10586配合使用的麦克风,请发布该声音.

It is not really nice to use a webcam as microphone. If someone has a microphone that works with SpeechRecognizer and Windows IoT 10.0.10586 please post it.


如果您寻找带有语法文件示例的SpeechRecognizer ContinuousRecognitionSession,则可以查看以下项目.在评论中,您可以看到如何将其他语言与SpeechRecognizer一起使用.


If you look for a SpeechRecognizer ContinuousRecognitionSession with a grammar file example you can look in following project. In the comments you can see how you can use other languages with SpeechRecognizer.

https://www.hackster.io/krvarma/rpivoice-051857


也许将来的Windows Updates中会更新驱动程序,而我们不再遇到此类问题.


Perhaps there is in future driver updates in Windows Updates and we no longer have such problems.

这篇关于SpeechRecognizer无法正常工作,COMException:未注册类/UWP App Windows IoT(10.0.10586)和Visual Studio 2015更新1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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