Dual-Tone Multi-Frequency (DTMF) tones are generated by pressing the keys on a telephone. With the DtmfRecognitionEngine class, the Microsoft Speech Platform SDK 11 supports the use of speech recognition grammars to analyze DTMF input emitted by telephones. The members of DtmfRecognitionEngine are similar to those of the SpeechRecognitionEngine class. However, the input for recognition consists of a series of DTMF tones instead of an audio stream.
You can create DTMF grammars programmatically using members of the Microsoft.Speech.Recognition.SrgsGrammar namespace, or create static DTMF grammar files using XML that conforms to the Speech Recognition Grammar Specification (SRGS) Version 1.0. Whether programmatic (dynamic) or XML (static), DTMF grammars can be loaded at runtime by the DtmfRecognitionEngine using the LoadGrammar(Grammar) or LoadGrammarAsync(Grammar) methods.
When performing recognition, the DtmfRecognitionEngine raises events that inform your application about key stages in a recognition operation, such as LoadGrammarCompleted, DtmfHypothesized, DtmfRecognized, DtmfRecognitionRejected, and RecognizeCompleted. You can use the EventArgs class associated with each event to create handlers that return information from the event to your application.
You can use the following methods of the DtmfRecognitionEngine class to manage DTMF tones:
Additional methods allow you to initiate DTMF recognition (RecognizeAsync()), terminate DTMF recognition (RecognizeAsyncCancel()), and unload grammars from the DtmfRecognitionEngine object (UnloadAllGrammars() and UnloadGrammar(Grammar)).