Provides access to run any properly installed speech recognition services found on a Windows Desktop system.
Namespace:
System.Speech.Recognition
Assembly:
System.Speech (in System.Speech.dll)
Visual Basic (Declaration)
Public Class SpeechRecognitionEngine _
Implements IDisposable
Dim instance As SpeechRecognitionEngine
public class SpeechRecognitionEngine : IDisposable
public ref class SpeechRecognitionEngine : IDisposable
public class SpeechRecognitionEngine implements IDisposable
Applications using SpeechRecognitionEngine select anyone of the Windows Desktop Speech Technology compatible recognition engine available on a given system, as well as choose a particular form of audio input -- including the stantdard audio input, streams, and files.
Therefore, SpeechRecognitionEngine based applications can be constructed as clients of a particular recognition engine, as standalone speech recognition applications using inprocess recognition engines, and as servers, providing access to a recognition engine to clients.
Note: |
|---|
While SpeechRecognitionEngine based applications can use the system default audio input and recognition engines, it is recommended that the SpeechRecognitionEngine object be used instead for that purpose. |
Applications using SpeechRecognitionEngine effectively do so by selecting the correct recognizer and culture when constructing an instance, connecting to the appropriate audio input, creating event handlers to receive audio recognition results, controlling the grammars used in recognition, and by starting and stopping recognition engines.
To support this, SpeechRecognitionEngine provides programmatic control over:
Selection of audio inputs, recognition engines, language and culture (see SpeechRecognitionEngine, InstalledRecognizers, and SetInputToWaveFile, SetInputToAudioStream, SetInputToNull, SetInputToWaveStream, and SetInputToDefaultAudioDevice)
The handling of both synchronous and asynchronous recognition operations (see Recognize, RecognizeAsync,.RecognizeAsyncStop, RecognizeAsyncCancel, and RecognizeCompleted).
The grammars are used by the application (see LoadGrammar, UnloadGrammar, UnloadAllGrammars, and Grammars for more information).
Define parameters for speech recognition operations (see RejectionThreshold()()(), BabbleTimeout, InitialSilenceTimeout, EndSilenceTimeout, EndSilenceTimeoutAmbiguous, RejectionThreshold()()())
How recognition engine events, such as recognition or rejection of a phrase, are handled (see SpeechDetected, SpeechHypothesized, SpeechRecognitionRejected, SpeechRecognized, and LoadGrammarCompleted()()() for more information.
These recognition events are the means used by instances of SpeechRecognitionEngine to return recognition results to applications.
Control and monitor the Windows Desktop Speech Technology recognition engine state (see QueryRecognitionEngineSetting(String), MaxAlternates, RecognzierInfo()()(), RecognitionEngineUpdateReached()()(), AudioStateChanged, AudioSignalProblemOccurred, and AudioLevelUpdated)
Synchronizing and scheduling of configuration changes requested by a client application using members of used by an instance of SpeechRecognitionEngine.
This is necessary because the Windows Desktop Speech Technology can be shared between multiple applications and process and running a different processes. (See PauseRecognitionEngineOnRecognition()()(), and RequestRecognitionEngineUpdate()()() for more information.)
Test an applications use of the Windows Desktop Speech Technology through emulation (see EmulateRecognize, EmulateRecognizeAsync, and EmulateRecognizeCompleted).
SpeechRecognitionEngine implements [IDispose].
The example below queries the system to find a recognition engine with the identification string and CultureID. Note, before this instance of SpeechRecognitionEngine can be used, it must have its input set, using SetInputToNull, SetInputToWaveStream, or SetInputToDefaultAudioDevice).
private SpeechRecognitionEngine SelectRecognitionEngine(CultureInfo requiredCulture, string requiredId) {
// Select based on a specific recognitionEngine configuration:
SpeechRecognitionEngine speechRecognitionEngine=null;
foreach (RecognzierInfo config in SpeechRecognitionEngine.InstalledRecognizers()) {
if (config.Culture.Equals(requiredCulture) && config.Id== requiredId) {
speechRecognitionEngine = new SpeechRecognitionEngine(config);
break;
}
}
return speechRecognitionEngine;
}
System..::.Object
System.Speech.Recognition..::.SpeechRecognitionEngine
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0
Reference