Presentation is loading. Please wait.

Presentation is loading. Please wait.

Recognizes: Magic Memo, show me memo number three. Magic Memo, show memo one. Magic Memo, display memo number two. Magic Memo, display memo.

Similar presentations


Presentation on theme: "Recognizes: Magic Memo, show me memo number three. Magic Memo, show memo one. Magic Memo, display memo number two. Magic Memo, display memo."— Presentation transcript:

1

2

3

4

5

6

7

8

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 }

11

12

13

14

15

16

17

18

19

20

21

22

23

24

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

27

28

29

30

31

32


Download ppt "Recognizes: Magic Memo, show me memo number three. Magic Memo, show memo one. Magic Memo, display memo number two. Magic Memo, display memo."

Similar presentations


Ads by Google