Speech recognition for Windows Phone 8

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Speech recognition can be a natural, efficient, and accurate way for users to interact with apps in Windows Phone 8. To support speech recognition, Windows Phone 8 includes a speech runtime, recognition APIs for programming the runtime, ready-to-use grammars for dictation and web search, and a GUI that helps users discover and use speech recognition features.

Nota

To use speech recognition, you must set the ID_CAP_SPEECH_RECOGNITION, ID_CAP_MICROPHONE, and ID_CAP_NETWORKING capabilities in the app manifest. If you do not set these capabilities, your app might not work correctly. For more info, see App capabilities and hardware requirements for Windows Phone 8.

Basic speech recognition example

The quickest and easiest way to enable your app for speech recognition is to use the predefined dictation grammar included with Windows Phone 8. The dictation grammar will recognize most words and short phrases in a language, and is activated by default when a speech recognizer object is instantiated. Using the predefined dictation grammar, you can enable speech recognition with just a few lines of code, as in the following example:

private async void ButtonSR_Click(object sender, RoutedEventArgs e)
{
  // Create an instance of SpeechRecognizerUI.
  this.recoWithUI = new SpeechRecognizerUI();

  // Start recognition (load the dictation grammar by default).
  SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync();

  // Do something with the recognition result.
  MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text));
}

In this section

This section discusses the following topics related to speech recognition:

Speech recognition errors and exceptions

There are many speech recognition errors and exceptions that you might encounter when working with the feature, including an error that occurs when the speech privacy policy is not accepted. For more info about these errors and exceptions, see Handling errors in speech apps for Windows Phone 8.

See Also

Other Resources

Recognition using Custom Grammars Sample

Short message dictation and web search grammars sample

Speech recognition and text-to-speech sample

More Speech for Windows Phone Samples