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).
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();
To get the sample work enable the following capabilities in the Package.appxmainifest:
Internet (Client) and Microphone
Edit
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).
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.");
}
To get the sample work enable the following capabilities in the Package.appxmainifest:
Internet (Client) and Microphone