Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The SpeechRecognizer property binds the SpeechRecognizerUx control to a SpeechRecognizer instance. This step is required for the SpeechRecognizerUx control to function.
Syntax
public SpeechRecognizerUx SpeechRecognizer(get; set;)
Property Value
SpeechRecognizerUx
The SpeechRecognizer instance to use.
Remarks
In JavaScript applications, you must set this property locally before calling the SpeechRecognizer.RecognizeSpeechToTextAsync() method. In C#/XAML, you may set the property once on a global SpeechRecognizer object and it will retain scope through the life of the application.
Example
The following code example creates a SpeechRecognizer instance, creates a SpeechRecognizerUx, binds them together, and adds the control to a UI container element named SpeechHostPanel.
using Microsoft.Bing.Speech;
using Microsoft.Bing.Speech.Xaml;
...
public MainPage()
{
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
}
SpeechRecognizer SR;
private 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 speech recognizer.
SR = new SpeechRecognizer("en-US", credentials);
// Create a SpeechRecognizerUx control and bind it to
// the speech recognizer.
var SpeechControl = new.SpeechRecognizerUx();
SpeechControl.SpeechRecognizer = SR;
// Add the control to the page.
SpeechHostPanel.Children.Add(SpeechControl);
}
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);
// Create a SpeechRecognizerUx control.
var speechControl = new Bing.Speech.Xaml.SpeechRecognizerUx();
speechControl.id = "SpeechControl";
// Add the control to the page.
document.getElementById("SpeechHostPanel").AppendChild(speechControl);
}
function speakButton_Click(sender, e) {
// Bind the control to the SpeechRecognizer locally
// before calling RecognizeSpeechToTextAsync.
document.getElementById("SpeechControl").winControl.speechRecognizer = SR;
...
}
Requirements
Minimum Supported Client |
Windows 8 |
Required Extensions |
Bing.Speech |
Namespace |