Speech for
Windows Phone 8


       Marco Massarelli
    http://ceoloide.com
Speech for Windows Phone 8


1. Voice commands
2. Speech recognition
3. Text-to-speech (TTS)
4. Q&A
11   Voice commands
1   Voice commands

                                YOUR APP

                           SPEECH RECOGNITION

          VOICE COMMANDS
                           TEXT-TO-SPEECH (TTS)




• Application entry point
• Can act as deep links to your application
1    Voice commands
• Set up your project capabilities:
   – D_CAP_SPEECH_RECOGNITION,
   – ID_CAP_MICROPHONE,
   – ID_CAP_NETWORKING

• Create a new Voice Command Definition
1   Voice commands

        <?xml version="1.0" encoding="utf-8"?>
        <VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.0">

           <CommandSet xml:lang="en-us">
                <CommandPrefix> Contoso Widgets </CommandPrefix>
                <Example> Show today's specials </Example>
                <Command Name="showWidgets">
                      <Example> Show today's specials </Example>
                      <ListenFor> [Show] {widgetViews} </ListenFor>
                      <ListenFor> {*} [Show] {widgetViews} </ListenFor>
                      <Feedback> Showing {widgetViews} </Feedback>
                      <Navigate Target="/favorites.xaml"/>
                </Command>
                <PhraseList Label="widgetViews">
                      <Item> today's specials </Item>
                      <Item> best sellers </Item>
                </PhraseList>
           </CommandSet>

           <!-- Other CommandSets for other languages -->

        </VoiceCommands>
1          Voice commands

• Install the Voice Command Definition (VCD) file
  await VoiceCommandService.InstallCommandSetsFromFileAsync( new Uri("ms-appx:///ContosoWidgets.xml") );




• VCD files need to be installed again when a
  backup is restored on a device.
1           Voice commands

• Voice commands parameters are included in the
  QueryString property of the NavigationContext
  "/favorites.xaml?voiceCommandName=showWidgets&widgetViews=best%20sellers&reco=Contoso%20Widgets%Show%20best%20sellers"




• Asterisks in ListenFor phrases are passed as “…”
  – In other words, it is not possible to receive the actual
    text that matched the asterisk.
2
1   Speech recognition
2   Speech recognition

                                YOUR APP

                           SPEECH RECOGNITION

          VOICE COMMANDS
                           TEXT-TO-SPEECH (TTS)




• Natural interaction with your application
• Grammar-based
• Requires internet connection
2    Speech recognition

• Default dictation grammar for free-text
  and web-search are included in WP8
• Custom grammar can be defined in two
  ways:
  – Programmatic list grammar (array of strings)
  – XML grammar leveraging on Speech
    Recognition Grammar Specification (SRGS) 1.0
2         Speech recognition

• Default dictation grammar

  private async void ButtonWeatherSearch_Click(object sender, RoutedEventArgs e)
  {
         // Add the pre-defined web search grammar to the grammar set.
         SpeechRecognizerUI recoWithUI = new SpeechRecognizerUI();

          recoWithUI.Recognizer.Grammars.AddGrammarFromPredefinedType ("weatherSearch",
          SpeechPredefinedGrammar.WebSearch);

          // Display text to prompt the user's input.
          recoWithUI.Settings.ListenText = "Say what you want to search for";

          // Display an example of ideal expected input.
          recoWithUI.Settings.ExampleText = @"Ex. 'weather for London'";

          // Load the grammar set and start recognition.
          SpeechRecognitionUIResult result = await recoWithUI.RecognizeWithUIAsync();
  }
2         Speech recognition

• Programmatic list grammar
  private async void ButtonSR_Click(object sender, RoutedEventArgs e)
  {
         SpeechRecognizerUI recoWithUI = new SpeechRecognizerUI();

          // You can create this string dynamically, for example from a movie queue.
          string[] movies = { "Play The Cleveland Story", "Play The Office", "Play Psych", "Play Breaking
          Bad", "Play Valley of the Sad", "Play Shaking Mad" };

          // Create a grammar from the string array and add it to the grammar set.
          recoWithUI.Recognizer.Grammars.AddGrammarFromList("myMovieList", movies);

          // Display an example of ideal expected input.
          recoWithUI.Settings.ExampleText = @"ex. 'Play New Mocumentaries'";

          // Load the grammar set and start recognition.
          SpeechRecognitionUIResult result = await recoWithUI.RecognizeWithUIAsync();

          // Play movie given in result.Text
  }
2         Speech recognition

• XML grammar
 private async void ButtonSR_Click(object sender, EventArgs e)
 {
        // Initialize objects ahead of time to avoid delays when starting recognition.
        SpeeechRecognizerUI recoWithUI = new SpeechRecognizerUI();

         // Initialize a URI with a path to the SRGS-compliant XML file.
         Uri orderPizza = new Uri("ms-appx:///OrderPizza.grxml", UriKind.Absolute);

         // Add an SRGS-compliant XML grammar to the grammar set.
         recoWithUI.Recognizer.Grammars.AddGrammarFromUri("PizzaGrammar", orderPizza);

         // Preload the grammar set.
         await recoWithUI.Recognizer.PreloadGrammarsAsync();

         // Display text to prompt the user's input.
         recoWithUI.Settings.ListenText = "What kind of pizza do you want?";

         // Display an example of ideal expected input.
         recoWithUI.Settings.ExampleText = "Large combination with Italian sausage";

         SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();
 }
2   Speech recognition
3
2   Text-to-speech
         (TTS)
3    Text-to-speech (TTS)

                                YOUR APP

                           SPEECH RECOGNITION

          VOICE COMMANDS
                           TEXT-TO-SPEECH (TTS)




• Output synthetized speech
• Provide the user with spoken instructions
3   Text-to-speech (TTS)

• TTS requires only the following capability:
  – ID_CAP_SPEECH_RECOGNITION
• TTS can output the following text types:
  – Unformatted text strings
  – Speech Synthesis Markup Language (SSML)
    1.0 strings or XML files
3       Text-to-speech (TTS)
• Outputting unformatted strings is very easy and
  it is also possible to select a voice language:
       // Declare the SpeechSynthesizer object at the class level.
       SpeechSynthesizer synth;

       private async void ButtonSimpleTTS_Click(object sender, RoutedEventArgs e)
       {
              SpeechSynthesizer synth = new SpeechSynthesizer();
              await synth.SpeakTextAsync("You have a meeting with Peter in 15 minutes.");
       }

       private async void SpeakFrench_Click_1(object sender, RoutedEventArgs e)
       {

             synth = new SpeechSynthesizer(); // Query for a voice that speaks French.

             IEnumerable<VoiceInformation> frenchVoices = from voice in InstalledVoices.All
             where voice.Language == "fr-FR" select voice;

             // Set the voice as identified by the query.
             synth.SetVoice(frenchVoices.ElementAt(0));

             // Count in French.
             await synth.SpeakTextAsync("un, deux, trois, quatre");
       }
3         Text-to-speech (TTS)

• SSML 1.0 text can be outputted from string
  or XML files
   // Speaks a string of text with SSML markup.
   private async void SpeakSsml_Click(object sender, RoutedEventArgs e) {
          SpeechSynthesizer synth = new SpeechSynthesizer(); // Build an SSML prompt in a string.
          string ssmlPrompt = "<speak version="1.0" ";
          ssmlPrompt += "xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">";
          ssmlPrompt += "This voice speaks English. </speak>"; // Speak the SSML prompt.
          await synth.SpeakSsmlAsync(ssmlPrompt);
   }




   // Speaks the content of a standalone SSML file.
   private async void SpeakSsmlFromFile_Click(object sender, RoutedEventArgs e) {
          // Set the path to the SSML-compliant XML file.
          SpeechSynthesizer synth = new SpeechSynthesizer();

         string path = Package.Current.InstalledLocation.Path + "ChangeVoice.ssml";
         Uri changeVoice = new Uri(path, UriKind.Absolute); // Speak the SSML prompt.
         await synth.SpeakSsmlFromUriAsync(changeVoice);
   }
4
3   Q&A
4    Questions & Answers
• Speech for Windows Phone 8 API
  references:
  – http://msdn.microsoft.com/en-
    us/library/windowsphone/develop/jj206958(v
    =vs.105).aspx
Thank you!

More Related Content

PPT
Shell scripting - By Vu Duy Tu from eXo Platform SEA
PPTX
PowerShell 101
PPTX
Introduction To Power Shell
PPTX
system management -shell programming by gaurav raikar
PPTX
Easiest way to start with Shell scripting
PPTX
Powershell alias
PDF
Pycon - Python for ethical hackers
PPT
Chap06
Shell scripting - By Vu Duy Tu from eXo Platform SEA
PowerShell 101
Introduction To Power Shell
system management -shell programming by gaurav raikar
Easiest way to start with Shell scripting
Powershell alias
Pycon - Python for ethical hackers
Chap06

What's hot (20)

ODP
Shellscripting
PPTX
Shell & Shell Script
PPT
Linux shell scripting
PPTX
Shell programming 1.ppt
PDF
Powershell notes
PDF
Erlang and Elixir
PDF
Shell scripting
PPTX
Penetration testing using python
PDF
Shell scripting
PPTX
Unix shell scripts
PPTX
Basics of shell programming
PDF
Quick start bash script
PPTX
SHELL PROGRAMMING
PPT
The Php Life Cycle
PDF
cq_cxf_integration
PPTX
Unix - Shell Scripts
PDF
Using Puppet on Linux, Windows, and Mac OSX
PDF
PHP 7 new engine
PPT
How PHP Works ?
PDF
Understanding PHP memory
Shellscripting
Shell & Shell Script
Linux shell scripting
Shell programming 1.ppt
Powershell notes
Erlang and Elixir
Shell scripting
Penetration testing using python
Shell scripting
Unix shell scripts
Basics of shell programming
Quick start bash script
SHELL PROGRAMMING
The Php Life Cycle
cq_cxf_integration
Unix - Shell Scripts
Using Puppet on Linux, Windows, and Mac OSX
PHP 7 new engine
How PHP Works ?
Understanding PHP memory
Ad

Similar to Speech for Windows Phone 8 (20)

PPTX
TDC 2014 - Cortana
PDF
Beyond Cortana & Siri: Using Speech Recognition & Speech Synthesis for the Ne...
PPTX
Windows Phone 8 - 14 Using Speech
PPTX
Cortana for Windows Phone
PDF
Fonctions vocales sous Windows Phone : intégrez votre application à Cortana !
PDF
Building Windows 10 Universal Apps with Speech and Cortana
PPTX
Integrando nuestra Aplicación Windows Phone con Cortana
PDF
Developing with Speech and Voice Recognition in Mobile Apps
PPTX
Code Camp - Presentation - Windows 10 - (Cortana)
PPTX
Aplikace pro rozpoznávání řeči - Jan Šedivý
PPTX
Droidcon ppt
PPTX
Hey Cortana!
PPTX
Text to speech converter in C#.NET
PDF
Introduction to Voice I/O on Android
PPTX
MS Champs meetup may 2014 on Cortana.
PPTX
Windows Phone 8 Sensors
PPTX
Integrating cortana with wp8 app
PDF
Microsoft Power Point Neuro Disorders
PPT
Tulsa Techfest 2008 - Creating A Voice User Interface With Speech Server
PDF
4Developers 2015: Talking and listening to web pages - Aurelio De Rosa
TDC 2014 - Cortana
Beyond Cortana & Siri: Using Speech Recognition & Speech Synthesis for the Ne...
Windows Phone 8 - 14 Using Speech
Cortana for Windows Phone
Fonctions vocales sous Windows Phone : intégrez votre application à Cortana !
Building Windows 10 Universal Apps with Speech and Cortana
Integrando nuestra Aplicación Windows Phone con Cortana
Developing with Speech and Voice Recognition in Mobile Apps
Code Camp - Presentation - Windows 10 - (Cortana)
Aplikace pro rozpoznávání řeči - Jan Šedivý
Droidcon ppt
Hey Cortana!
Text to speech converter in C#.NET
Introduction to Voice I/O on Android
MS Champs meetup may 2014 on Cortana.
Windows Phone 8 Sensors
Integrating cortana with wp8 app
Microsoft Power Point Neuro Disorders
Tulsa Techfest 2008 - Creating A Voice User Interface With Speech Server
4Developers 2015: Talking and listening to web pages - Aurelio De Rosa
Ad

Recently uploaded (20)

PPTX
Configure Apache Mutual Authentication
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
Build Your First AI Agent with UiPath.pptx
PDF
Early detection and classification of bone marrow changes in lumbar vertebrae...
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Statistics on Ai - sourced from AIPRM.pdf
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
DOCX
search engine optimization ppt fir known well about this
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
Advancing precision in air quality forecasting through machine learning integ...
Configure Apache Mutual Authentication
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
Auditboard EB SOX Playbook 2023 edition.
Rapid Prototyping: A lecture on prototyping techniques for interface design
Transform-Quality-Engineering-with-AI-A-60-Day-Blueprint-for-Digital-Success.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
sustainability-14-14877-v2.pddhzftheheeeee
Enhancing plagiarism detection using data pre-processing and machine learning...
Build Your First AI Agent with UiPath.pptx
Early detection and classification of bone marrow changes in lumbar vertebrae...
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Statistics on Ai - sourced from AIPRM.pdf
Convolutional neural network based encoder-decoder for efficient real-time ob...
search engine optimization ppt fir known well about this
Flame analysis and combustion estimation using large language and vision assi...
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
Comparative analysis of machine learning models for fake news detection in so...
Advancing precision in air quality forecasting through machine learning integ...

Speech for Windows Phone 8

  • 1. Speech for Windows Phone 8 Marco Massarelli http://ceoloide.com
  • 2. Speech for Windows Phone 8 1. Voice commands 2. Speech recognition 3. Text-to-speech (TTS) 4. Q&A
  • 3. 11 Voice commands
  • 4. 1 Voice commands YOUR APP SPEECH RECOGNITION VOICE COMMANDS TEXT-TO-SPEECH (TTS) • Application entry point • Can act as deep links to your application
  • 5. 1 Voice commands • Set up your project capabilities: – D_CAP_SPEECH_RECOGNITION, – ID_CAP_MICROPHONE, – ID_CAP_NETWORKING • Create a new Voice Command Definition
  • 6. 1 Voice commands <?xml version="1.0" encoding="utf-8"?> <VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.0"> <CommandSet xml:lang="en-us"> <CommandPrefix> Contoso Widgets </CommandPrefix> <Example> Show today's specials </Example> <Command Name="showWidgets"> <Example> Show today's specials </Example> <ListenFor> [Show] {widgetViews} </ListenFor> <ListenFor> {*} [Show] {widgetViews} </ListenFor> <Feedback> Showing {widgetViews} </Feedback> <Navigate Target="/favorites.xaml"/> </Command> <PhraseList Label="widgetViews"> <Item> today's specials </Item> <Item> best sellers </Item> </PhraseList> </CommandSet> <!-- Other CommandSets for other languages --> </VoiceCommands>
  • 7. 1 Voice commands • Install the Voice Command Definition (VCD) file await VoiceCommandService.InstallCommandSetsFromFileAsync( new Uri("ms-appx:///ContosoWidgets.xml") ); • VCD files need to be installed again when a backup is restored on a device.
  • 8. 1 Voice commands • Voice commands parameters are included in the QueryString property of the NavigationContext "/favorites.xaml?voiceCommandName=showWidgets&widgetViews=best%20sellers&reco=Contoso%20Widgets%Show%20best%20sellers" • Asterisks in ListenFor phrases are passed as “…” – In other words, it is not possible to receive the actual text that matched the asterisk.
  • 9. 2 1 Speech recognition
  • 10. 2 Speech recognition YOUR APP SPEECH RECOGNITION VOICE COMMANDS TEXT-TO-SPEECH (TTS) • Natural interaction with your application • Grammar-based • Requires internet connection
  • 11. 2 Speech recognition • Default dictation grammar for free-text and web-search are included in WP8 • Custom grammar can be defined in two ways: – Programmatic list grammar (array of strings) – XML grammar leveraging on Speech Recognition Grammar Specification (SRGS) 1.0
  • 12. 2 Speech recognition • Default dictation grammar private async void ButtonWeatherSearch_Click(object sender, RoutedEventArgs e) { // Add the pre-defined web search grammar to the grammar set. SpeechRecognizerUI recoWithUI = new SpeechRecognizerUI(); recoWithUI.Recognizer.Grammars.AddGrammarFromPredefinedType ("weatherSearch", SpeechPredefinedGrammar.WebSearch); // Display text to prompt the user's input. recoWithUI.Settings.ListenText = "Say what you want to search for"; // Display an example of ideal expected input. recoWithUI.Settings.ExampleText = @"Ex. 'weather for London'"; // Load the grammar set and start recognition. SpeechRecognitionUIResult result = await recoWithUI.RecognizeWithUIAsync(); }
  • 13. 2 Speech recognition • Programmatic list grammar private async void ButtonSR_Click(object sender, RoutedEventArgs e) { SpeechRecognizerUI recoWithUI = new SpeechRecognizerUI(); // You can create this string dynamically, for example from a movie queue. string[] movies = { "Play The Cleveland Story", "Play The Office", "Play Psych", "Play Breaking Bad", "Play Valley of the Sad", "Play Shaking Mad" }; // Create a grammar from the string array and add it to the grammar set. recoWithUI.Recognizer.Grammars.AddGrammarFromList("myMovieList", movies); // Display an example of ideal expected input. recoWithUI.Settings.ExampleText = @"ex. 'Play New Mocumentaries'"; // Load the grammar set and start recognition. SpeechRecognitionUIResult result = await recoWithUI.RecognizeWithUIAsync(); // Play movie given in result.Text }
  • 14. 2 Speech recognition • XML grammar private async void ButtonSR_Click(object sender, EventArgs e) { // Initialize objects ahead of time to avoid delays when starting recognition. SpeeechRecognizerUI recoWithUI = new SpeechRecognizerUI(); // Initialize a URI with a path to the SRGS-compliant XML file. Uri orderPizza = new Uri("ms-appx:///OrderPizza.grxml", UriKind.Absolute); // Add an SRGS-compliant XML grammar to the grammar set. recoWithUI.Recognizer.Grammars.AddGrammarFromUri("PizzaGrammar", orderPizza); // Preload the grammar set. await recoWithUI.Recognizer.PreloadGrammarsAsync(); // Display text to prompt the user's input. recoWithUI.Settings.ListenText = "What kind of pizza do you want?"; // Display an example of ideal expected input. recoWithUI.Settings.ExampleText = "Large combination with Italian sausage"; SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync(); }
  • 15. 2 Speech recognition
  • 16. 3 2 Text-to-speech (TTS)
  • 17. 3 Text-to-speech (TTS) YOUR APP SPEECH RECOGNITION VOICE COMMANDS TEXT-TO-SPEECH (TTS) • Output synthetized speech • Provide the user with spoken instructions
  • 18. 3 Text-to-speech (TTS) • TTS requires only the following capability: – ID_CAP_SPEECH_RECOGNITION • TTS can output the following text types: – Unformatted text strings – Speech Synthesis Markup Language (SSML) 1.0 strings or XML files
  • 19. 3 Text-to-speech (TTS) • Outputting unformatted strings is very easy and it is also possible to select a voice language: // Declare the SpeechSynthesizer object at the class level. SpeechSynthesizer synth; private async void ButtonSimpleTTS_Click(object sender, RoutedEventArgs e) { SpeechSynthesizer synth = new SpeechSynthesizer(); await synth.SpeakTextAsync("You have a meeting with Peter in 15 minutes."); } private async void SpeakFrench_Click_1(object sender, RoutedEventArgs e) { synth = new SpeechSynthesizer(); // Query for a voice that speaks French. IEnumerable<VoiceInformation> frenchVoices = from voice in InstalledVoices.All where voice.Language == "fr-FR" select voice; // Set the voice as identified by the query. synth.SetVoice(frenchVoices.ElementAt(0)); // Count in French. await synth.SpeakTextAsync("un, deux, trois, quatre"); }
  • 20. 3 Text-to-speech (TTS) • SSML 1.0 text can be outputted from string or XML files // Speaks a string of text with SSML markup. private async void SpeakSsml_Click(object sender, RoutedEventArgs e) { SpeechSynthesizer synth = new SpeechSynthesizer(); // Build an SSML prompt in a string. string ssmlPrompt = "<speak version="1.0" "; ssmlPrompt += "xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">"; ssmlPrompt += "This voice speaks English. </speak>"; // Speak the SSML prompt. await synth.SpeakSsmlAsync(ssmlPrompt); } // Speaks the content of a standalone SSML file. private async void SpeakSsmlFromFile_Click(object sender, RoutedEventArgs e) { // Set the path to the SSML-compliant XML file. SpeechSynthesizer synth = new SpeechSynthesizer(); string path = Package.Current.InstalledLocation.Path + "ChangeVoice.ssml"; Uri changeVoice = new Uri(path, UriKind.Absolute); // Speak the SSML prompt. await synth.SpeakSsmlFromUriAsync(changeVoice); }
  • 21. 4 3 Q&A
  • 22. 4 Questions & Answers • Speech for Windows Phone 8 API references: – http://msdn.microsoft.com/en- us/library/windowsphone/develop/jj206958(v =vs.105).aspx