I'm trying to add speech recognition to my Unity project. The turtle demo works fine; I can control it with my voice.
In my own project I'm trying to search for the english language recognizer:
string recognizerId = "SR_MS_en-US_Kinect_11.0";
RecognizerInfo ri = SpeechRecognitionEngine.InstalledRecognizers ().Where (r => r.Id == recognizerId).FirstOrDefault ();
Which results in a nullreference error.
I've also tried searching through all installed recognizers:
foreach (RecognizerInfo recognizerinfo in SpeechRecognitionEngine.InstalledRecognizers())
{
string value;
recognizerinfo.AdditionalInfo.TryGetValue("Kinect", out value);
if("True".Equals(value, StringComparison.OrdinalIgnoreCase) && "en-US".Equals(recognizerinfo.Culture.Name, StringComparison.OrdinalIgnoreCase))
{
return recognizerinfo;
}
}
Same error. I have checked my registry and it looks fine to me: http://puu.sh/gOOyy/9a900bc335.png
Here's the full error i'm getting:
NullReferenceException: Object reference not set to an instance of an object
Microsoft.Speech.Internal.ObjectTokens.RegistryDataKey.HKEYfromRegKey (Microsoft.Win32.RegistryKey regKey)
Microsoft.Speech.Internal.ObjectTokens.RegistryDataKey.RootHKEYFromRegPath (System.String rootPath)
Microsoft.Speech.Internal.ObjectTokens.RegistryDataKey.Open (System.String registryPath, Boolean fCreateIfNotExist)
Microsoft.Speech.Internal.ObjectTokens.ObjectTokenCategory.Create (System.String sCategoryId)
Microsoft.Speech.Recognition.SpeechRecognitionEngine.InstalledRecognizers ()
SpeechRecognition.GetKinectRecognizer () (at Assets/SpeechRecognition.cs:15)
SpeechRecognition.CreateSpeechRecognizer () (at Assets/SpeechRecognition.cs:31)
SpeechRecognition.InitializeKinect () (at Assets/SpeechRecognition.cs:76)
SpeechRecognition.Start () (at Assets/SpeechRecognition.cs:83)
I have the Microsoft Serve Speech Platform Runtime, Microsot Speech platform SDK v11.0 and Kinect for Windows Speech Recognition Language Pack (en-US) installed and I have tried reinstalling to no avail, unfortunately. Hopefully someone can help me.
edit: even if I just test this:
System.Collections.ObjectModel.ReadOnlyCollection<RecognizerInfo> test = SpeechRecognitionEngine.InstalledRecognizers();
I get the same error. If there were no installed recognizers, the test variable would just be null right?
edit2: I just tested this code in Visual Studio and it works. So for some reason Unity doesn't want to access the registry?