This sample demonstrates how to use speech recognition and synthesis to carry on a speech dialog with the user. Speaking a color name changes the background color of a box in the UI, and the app speaks the color back to you. The app continues to listen for more input from the user until the user explicitly stops speech recognition. When the app runs, you first must accept the speech privacy policy by following the instructions listed on the app's start screen, and then tap 'Start speech recognition'. Then, simply speak the name of a color. The background color of the box shown in the app will be updated, and the app will speak the action that's occurring. This sample shows you how to:

  • Handle the speech privacy policy

  • Implement speech recognition

  • Create a custom list grammar

  • Output spoken text using TTS

  • Continuous speech recognition

This sample uses the Windows.Phone.Speech.Recognition and Windows.Phone.Speech.Synthesis Windows Phone Runtime APIs. For more info about the speech feature in Windows Phone 8, see Speech for Windows Phone 8.

Build the sample

  1. Start Visual Studio Express 2012 for Windows Phone and select File > Open > Project/Solution.

  2. Go to the directory in which you unzipped the sample. Double-click the Visual Studio Express 2012 for Windows Phone solution (.sln) file.

  3. Use Build > Rebuild Solution to build the sample.

Run the sample

  • To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.

Note Before trying your app in the emulator, verify that your microphone and audio are working properly. You can verify they are working with speech by trying a long press of the Start button, accepting the Speech Privacy Policy, and then testing a system Voice Command, e.g., "Start Internet Explorer".

See also