Download presentation
Presentation is loading. Please wait.
Published byAlaina Pope Modified over 9 years ago
9
Recognizes: Magic Memo, show me memo number three. Magic Memo, show memo one. Magic Memo, display memo number two. Magic Memo, display memo two.
10
using Windows.Phone.Speech.VoiceCommands; //... // Load the VoiceCommandDefinition file, usually on first run in App.xaml.cs private async void Application_Launching(object sender, LaunchingEventArgs e) { try { // Path to Voice Command Definition (VCD) file in application install path Uri uri = new Uri("ms-appx:///MagicMemoVCD.xml"); await VoiceCommandService.InstallCommandSetsFromFileAsync(uri); } catch (Exception ex) { // Handle Exception }
25
async private void InitializeSpeech() { commandReco = new SpeechRecognizerUI(); // Instantiate speech recognizer commandReco.Settings.ListenText = "Say a button name or select number"; // Prompt spoken to user commandReco.Settings.ExampleText = "Ex. 'Clear three' or 'Select two'"; // Displayed as examples // SRGS grammar to recognize button names and numbers Uri grammarFileUri = new Uri("ms-appx:///ViewMemos.grxml"); // Add grammar for later loading commandReco.Recognizer.Grammars.AddGrammarFromUri("srgsCommands", grammarFileUri); await commandReco.Recognizer.PreloadGrammarsAsync(); // Preload grammar to reduce latency (optional) } async private void MicImage_Tap(object sender, GestureEventArgs e) { var commandResult = await commandReco.RecognizeWithUIAsync(); // Start speech recognition if (commandResult.ResultStatus == SpeechRecognitionUIStatus.Succeeded) { // Execute command spoken by user } }
26
SpeechRecognizerUI SpeechRecognizer object Settings object: timeout values etc. Grammars collection indexed by grammar name AddGrammar Methods: Predefined from list SRGS grammar from URI Methods: PreLoadGrammarsAsync Get/Set Recognizer RecognizeAsync UI Settings object: UI text, Booleans to disable features Recognition Method: RecognizeWithUIAsync
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.