SpeechRecognition
Namespace: Wisej.Web.Ext.Speech
Assembly: Wisej.Web.Ext.Speech
The SpeechRecognition interface of Web Speech API allows JavaScript to have access to a browser's audio stream and convert it to text.
- C#
- VB.NET
public class SpeechRecognition : Component, IExtenderProvider
Public Class SpeechRecognition
Inherits Component
Implements IExtenderProvider
Constructors
SpeechRecognition()
Properties
Continuous
Boolean: Controls whether continuous results are returned for each recognition, or only a single result. (Default: False)
Enabled
Boolean: Enables or disables the this SpeechRecognition extender. (Default: False)
Grammars
String[]: Returns and sets a collection of grammar definitions - using the JSpeech Grammar Format (JSGF) https://www.w3.org/TR/jsgf/.
InterimResults
Boolean: Controls whether interim results should be returned (true) or not (false.) Interim results are results that are not yet final (e.g. the SpeechRecognitionResult.isFinal property is false.) (Default: False)
Language
String: Returns and sets the language of the current SpeechRecognition. If not specified, this defaults to the HTML lang attribute value, or the user agent's language setting if that isn't set either. (Default: null)
MaxAlternatives
Int32: Returns and sets the maximum number of alternatives provided per each speech recognition result. (Default: 1)
Methods
Abort()
Stops the speech recognition service from listening to incoming audio, and doesn't attempt to return a result.
CanExtend(target)
Returns true if SpeechRecognition can offer an extender property to the specified target component.
| Parameter | Type | Description |
|---|---|---|
| target | Object | The target object to add an extender property to. |
Returns: Boolean. true if the SpeechRecognition class can offer one or more extender properties; otherwise, false.
Clear()
Removes all speech extenders.
GetSpeechRecognition(control)
SpeechRecognition properties.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The Control for which to retrieve the speech properties. |
Returns: Properties. A Properties instance with the SpeechRecognition properties.
SetSpeechRecognition(control, properties)
Assigns the speech recognition properties to the control.
| Parameter | Type | Description |
|---|---|---|
| control | Control | The control to rotate. |
| properties | Properties | An instance of Properties defining the speech listeners. |
Start()
Starts the speech recognition service listening to incoming audio.
Stop()
Stops the speech recognition service from listening to incoming audio, and attempts to return a result using the audio captured so far.
Events
Error
SpeechRecognitionEventHandler Occurs when a speech recognition error is detected.
NoMatch
EventHandler Occurs when the speech recognition service returns a final result with no significant recognition (when the nomatch event fires.)
Result
SpeechRecognitionEventHandler Fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app (when the result event fires.)
SpeechEnd
EventHandler Occurs when speech recognised by the speech recognition service has stopped being detected (when the speechend event fires.)
SpeechStart
EventHandler Occurs when sound recognised by the speech recognition service as speech has been detected.