Working with Tips in the Bing Speech Recognition Control

 

This document describes best practices about setting Tips in the Bing Speech Recognition Control. The Tips feature is part of the SpeechRecognizerUx class.

Prerequisites for Speech Recognition in Windows Store applications

Before creating speech-enabled applications, you must install the speech control from Visual Studio Gallery or from the Visual Studio Extension Manager, as described in How to: Register and install the Bing Speech Recognition Control. Then, for each project that will use the Speech control, you must complete the preparatory steps described in How to: Enable a project for the Bing Speech Recognition Control.

Tips in the Bing Speech Recognition control

The Tips feature is provided so that you can give guidance to your users about how to interact effectively with your application. This may include technical recommendations, such as using a headset microphone, and speaking with a consistent volume, or suggestions specific to your application. If your app only uses the speech control for dictation and does not otherwise respond to what the user says, technical suggestions are probably enough. But if your app responds to particular words, phrases, or syntax, such as a mapping application that expects to hear "…near me," you should make that clear to your users.

Because the tips are displayed inside a limited portion of the SpeechRecognizerUx control, you should keep your tips short enough to fit on the smallest device you intend to support. The SpeechRecognizerUx control does not expand to accommodate Tips, so tips that are too long to fit in the Tips area of the control will be cut off.

Tips are set in the SpeechRecognizerUx.Tips property. To use tips without using the SpeechRecognizerUx control, create a global string array and display the strings during speech recognition.

General tips for speech recognition

The following sample tips may help users to get more accurate results from speech recognition.

  • If you are not getting accurate results, try using a headset microphone.

  • Speak with a consistent volume.

  • Speak in a natural rhythm with clear consonants.

  • Speak with a slow to moderate tempo.

  • Background noise may interfere with accurate speech recognition.

Tips for speech recognition in interactive applications

If you design your application to respond to particular keywords, phrases, or syntax, you can use Tips to describe the kinds of verbal input your app expects. The following example tips could show expected syntax for specific applications, depending on implementation.

  • Use "near" to specify proximity, for example, "gas stations near me."

  • To specify subcategories use 'class, subclass', for example, "restaurants, seafood."

  • To use the device camera, say "take a picture."

  • For help with the product, say "Help me with…" and then state the feature or error.

  • For italics, say "Contoso italics," then your phrase, then "end italics."

Code example

The following example populates the Tips array according to context, and then starts the microphone.

private void LocalButton_Click(object sender, RoutedEventArgs e)
{
    SpeechControl.Tips = new string[]
    {
        "Use \"near\" to specify proximity, for example, \"gas stations near me.\"",
        "To specify subcategories use 'class, subclass', for example, \"restaurants, seafood.\"",
        "Speak in a natural rhythm with clear consonants.",
        "For help with the product, say \"Help me with...\" and then state the feature or error."
    };
    var result = SR.RecognizeSpeechToTextAsync();

    // Use the result text in a local search.
    ...
}

private void SearchButton_Click(object sender, RoutedEventArgs e)
{
    SpeechControl.Tips = new string[]
    {
        "To specify subcategories use 'class, subclass', for example, \"restaurants, seafood.\"",
        "If you are not getting accurate results, try using a headset microphone.",
        "Speak with a consistent volume.",
        "For help with the product, say \"Help me with...\" and then state the feature or error."
    };
    var result = SR.RecognizeSpeechToTextAsync();

    // Use the result text for a web search.
    ...
}

private void DictateButton_Click(object sender, RoutedEventArgs e)
{
    SpeechControl.Tips = new string[]
    {
        "For italics, say \"Contoso italics,\" then your phrase, then \"end italics.\"",
        "To use the device camera, say \"take a picture.\"",
        "Background noise may interfere with accurate speech recognition.",
        "For help with the product, say \"Help me with...\" and then state the feature or error."
    };
    var result = SR.RecognizeSpeechToTextAsync();

    // Enter the result text and spoken formatting cues into an e-mail message.
    ...
}
function LocalButton_Click(object sender, RoutedEventArgs e) {
    var speechControl = document.getElementById('SpeechControl');
    speechControl.winControl.Tips = [
        "Use \"near\" to specify proximity, for example, \"gas stations near me.\"",
        "To specify subcategories use 'class, subclass', for example, \"restaurants, seafood.\"",
        "Speak in a natural rhythm with clear consonants.",
        "For help with the product, say \"Help me with...\" and then state the feature or error."
    ];

    speechControl.winControl.speechRecognizer = SR;
    SR.recognizeSpeechToTextAsync()
         .then(
             function (result) {
                 // Use the result text for a local search.
             })
}

function SearchButton_Click(object sender, RoutedEventArgs e) {
    var speechControl = document.getElementById('SpeechControl');
    speechControl.winControl.Tips = [
        "To specify subcategories use 'class, subclass', for example, \"restaurants, seafood.\"",
        "If you are not getting accurate results, try using a headset microphone.",
        "Speak with a consistent volume.",
        "For help with the product, say \"Help me with...\" and then state the feature or error."
    ];

    speechControl.winControl.speechRecognizer = SR;
    SR.recognizeSpeechToTextAsync()
         .then(
             function (result) {
                 // Use the result text for a web search.
             })
}

function DictateButton_Click(object sender, RoutedEventArgs e) {
    var speechControl = document.getElementById('SpeechControl');
    speechControl.winControl.Tips = [
        "For italics, say \"Contoso italics,\" then your phrase, then \"end italics.\"",
        "To use the device camera, say \"take a picture.\"",
        "Background noise may interfere with accurate speech recognition.",
        "For help with the product, say \"Help me with...\" and then state the feature or error."
    ];

    speechControl.winControl.speechRecognizer = SR;
    SR.recognizeSpeechToTextAsync()
         .then(
             function (result) {
                 // Enter the result text and spoken formatting cues into an e-mail message.
             })
}

Additional resources