Compartir a través de


SpeechRecognizer.SpeechRecognizer(string, SpeechAuthorizationParameters) constructor

 

The SpeechRecognizer(string) constructor initializes a new instance of the SpeechRecognizer class.

Syntax

public SpeechRecognizer (string language, SpeechAuthorizationParameters params)

Parameters

language

Type: System.String

The language code to use.

Type:Bing.Speech.SpeechAuthorizationParameters

A SpeechAuthorizationParameters object containing the Windows Azure Data Marketplace credentials for the application.

Remarks

The SpeechRecognizer uses the language specified in its constructor function to interpret audio input as speech. As of the April 2014 update, the following language options are supported:

  • de-DE – German (Germany)

  • en-US – English (Unites States)

  • en-GB – English (Great Britain)

  • es-ES – Spanish (Spain)

  • fr-FR – French (France)

  • it-IT – Italian (Italy)

  • zh-CN – Chinese (China)

The SpeechAuthorizationParameters object given for the second parameter must be initialized with a valid set of Windows Azure Data Marketplace credentials before calling this constructor. To obtain credentials for your application, see How to: Register and install the Bing Speech Recognition Control.

Example

The following example initializes a new SpeechRecognizer instance.

// Declare a global SpeechRecognizer object for the application.
SpeechRecognizer SR;

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    // Apply credentials from the Windows Azure Data Marketplace.
    var credentials = new SpeechAuthorizationParameters();
    credentials.ClientId = "<YOUR CLIENT ID>";
    credentials.ClientSecret = "<YOUR CLIENT SECRET>";

    // Initialize the SpeechRecognizer instance.
    SR = new SpeechRecognizer("en-US", credentials);
}
var SR;
function pageLoaded() {
    // Apply credentials from the Windows Azure Data Marketplace.
    var credentials = new Bing.Speech.SpeechAuthorizationParameters();
    credentials.clientId = "<YOUR CLIENT ID>";
    credentials.clientSecret = "<YOUR CLIENT SECRET>";

    // Initialize the speech recognizer.
    SR = new Bing.Speech.SpeechRecognizer("en-US", credentials);
}

Requirements

Minimum Supported Client

Windows 8

Required Extensions

Bing.Speech

Namespace

Bing.Speech