Types: GrammarRecognizer, PhraseRecognizedEventArgs, SpeechError, SpeechSystemStatus If (keywords.TryGetValue(args.text, out keywordAction))įinally, start recognizing! keywordRecognizer.Start() if the keyword recognized is in our dictionary, call that Action. Now register for the OnPhraseRecognized event keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized Īn example handler is: private void KeywordRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args) action to be performed when this keyword is spokenĬreate the keyword recognizer and tell it what we want to recognize: keywordRecognizer = new KeywordRecognizer(()) We're adding the "activate" keyword in this example: //Create keywords for keyword recognizer Now add a keyword to the dictionary, for example in of a Start() method. Then let's add a few fields to your class to store the recognizer and keyword->action dictionary: KeywordRecognizer keywordRecognizer We'll need a few using statements to save some keystrokes: using Types: KeywordRecognizer, PhraseRecognizedEventArgs, SpeechError, SpeechSystemStatus Handle the OnPhraseRecognized event and take action corresponding to the phrase recognized.Specify which phrases to listen for using a KeywordRecognizer or GrammarRecognizer.To enable your app to listen for specific phrases spoken by the user then take some action, you need to: You'll be asked to do this on device startup, but if you accidentally clicked "no" you can change the permissions in the device settings.Grant permissions to the app for microphone access on your HoloLens device.In the Publishing Settings > Capabilities section, check the Microphone capability.In the Unity Editor, navigate to Edit > Project Settings > Player.The Microphone capability must be declared for an app to use Voice input. If a GrammarRecognizer or KeywordRecognizer is active, a DictationRecognizer can't be active and vice versa. Dictation and phrase recognition can't be handled at the same time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |