SpeechRecognizerUx class
The SpeechRecognizerUx class is a control that you can drop into a XAML or HTML page to display speech recognition UI.
The SpeechRecognizerUx class has the following members.
Name | Description |
|---|---|
Initializes a new instance of the SpeechRecognizerUx class. |
Name | Description |
|---|---|
A list of suggestions from the application developer, to be displayed at random in the Tips area of the SpeechRecognizerUx. | |
The SpeechRecognizer instance that the SpeechRecognizerUx acts on. |
By default, the SpeechRecognizerUx control is hidden until the SpeechRecognizer.RecognizeSpeechToTextAsync() method is called, starting the speech recognition session. The SpeechRecognizerUx control then becomes visible, and displays the following control UI.
A Go button that calls the SpeechRecognizer.StopListeningAndProcessAudio() method, which cuts off speech input and starts interpreting what has already been said. The Go button is available when the speech recognition session is in the "Listening" state.
A Cancel button that calls the SpeechRecognizer.RequestCancelOperation() method, which ends the speech recognition session and collapses the control. Clicking or tapping outside of the control also calls the RequestCancelOperation() method. The Cancel button replaces the Go button when the speech recognition session moves from "Listening" to "Thinking".
A volume animation to display the current volume level while the user is speaking.
Intermediate results, displayed in the left portion of the control when the user is speaking.
A text scramble animation to indicate when speech input is being interpreted.
Example
The following example creates a microphone button, a SpeechRecognizerUx control, and a results TextBlock in the markup page. Then, in the code behind, it creates a SpeechRecognizer instance, binds the SpeechRecognizerUx control to it, and provides a simple handler for the click event of the microphone button.
<!-- If your app target Windows 8.1, use this markup --> <AppBarButton x:Name="SpeakButton" Icon="Microphone" Click="SpeakButton_Click"> </AppBarButton> <TextBlock x:Name="TextResults" /> <sp:SpeechRecognizerUx x:Name="SpeechControl" /> <!-- If your app targets Windows 8, use this markup. --> <Button x:Name="SpeakButton" Click="SpeakButton_Click" Style="{StaticResource MicrophoneAppBarButtonStyle}" AutomationProperties.Name="" /> <sp:SpeechRecognizerUx x:Name="SpeechControl" /> <TextBlock x:Name="ResultText" />
Example
When working with the SpeechRecognizerUx control in JavaScript, you must bind the control to the SpeechRecognizer in the local scope before calling RecognizeSpeechToTextAsync.
Requirements
Minimum Supported Client | Windows 8 |
Required Extensions | Bing.Speech |
Namespace |
The XAML AppBarButton element is only supported in Windows 8.1 or higher. To create a microphone button in Windows 8, you can use the MicrophoneAppBarButtonStyle, but you must first uncomment the style definition in StandardStyles.xaml. For more information, see How to: Add the Bing Speech Recognition Control to an application with the SpeechRecognizerUx class.