visual-studio-2015 - SpeechRecognizer 无法工作,COMException : Class not registered/UWP App Windows IoT (10. 0.10586) 和 Visual Studio 2015 Update 1

标签 visual-studio-2015 speech-recognition win-universal-app uwp windowsiot

安装 Windows IoT (10.0.10586) 和 Visual Studio 2015 Update 1 后,当我在 Raspberry Pi 2(使用 Windows IoT 10.0.10586)上的通用应用程序中使用 SpeechRecognizer 时,出现 COM-Exception。

如果我在 Windows 10 上运行 SpeechRecognizer UWP 应用程序,它可以正常工作,但 COM 异常仅出现在 Windows IoT (10.0.10586) 中。对于旧版本的 Windows IoT 和没有 Update 1 的 Visual Studio 2015,它也可以工作。

有人能解决这个问题吗?

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 中启用以下功能:

互联网(客户端)和麦克风

编辑

就像 Eric Brown 所说的,RecognizeWithUIAsync 似乎不适用于 Windows IoT(我没记错,似乎我从未使用过 RecognizeWithUIAsync,但我知道 SpeechRecognizer 过去可以工作)。

但是 RecognizeAsync 也不适用于我。没有抛出异常,但 RecognizeAsync 不等待语音,它直接返回一个 SpeechRecognitionResult 对象,其中属性 Confidence 为 Rejected,Status 为 Success,但语音 Text 始终为空字符串。它适用于 Windows 10,但不适用于 Windows IoT。

有谁知道为什么没有检测到语音/说出的单词不会被返回?

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 中启用以下功能:

互联网(客户端)和麦克风

最佳答案

RecognizeWithUIAsync 未在 Windows IoT 中实现(因为没有 UI)。您可以使用 RecognizeAsync 就可以了。

关于visual-studio-2015 - SpeechRecognizer 无法工作,COMException : Class not registered/UWP App Windows IoT (10. 0.10586) 和 Visual Studio 2015 Update 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34399726/

相关文章:

c# - 如果 IQueryable<T> 继承 IEnumerable<T> ,那么 IQueryable<T> 为什么是 LINQ to SQL?

nuget - 如何在 Visual Studio 2015 中启用 nuget 包还原?

python - python中如何选择pocketSphinx的语言模型

android - Android ICS 上的 App 内语音触发控制和离线语音识别

c# - 如何批量插入SQLITE数据库?

c# - 罗斯林-CodeDom : HowTo dynamically compile Code to Universal-Windows-Library

git - 在 Visual Studio 2015 中使用外部克隆的 Git 存储库

visual-studio-2015 - 为什么我的单元测试没有在项目输出文件夹中运行?

tensorflow - TensorFlow 音频/语音识别是否适用于多词触发关键字?

c# - 检查来自 UWP 应用的转储文件