This documentation is archived and is not being maintained.

SrgsGrammarMode Enumeration

Indicates the type of input that the Grammar object can expect.

Namespace: Microsoft.Speech.Recognition.SrgsGrammar
Assembly: Microsoft.Speech (in microsoft.speech.dll)

public enum SrgsGrammarMode
public enum SrgsGrammarMode
public enum SrgsGrammarMode

Member nameDescription
Dtmf The Grammar object should expect DTMF tones similar to those found on a telephone.
Voice The Grammar object should expect spoken audio data.

The default mode for speech recognition grammars is Voice. There are 16 DTMF tones, 12 of which are commonly found on most telephones.

Although the Mode attribute is used to inform the Grammar object of the type of input to expect, it is not exposed by that object. To set the mode, a SrgsDocument must be created and a Grammar object can be instantiated with the resulting SrgsDocument object.


string srgsDocumentFile = Path.Combine(Path.GetTempPath(), "srgsDocumentFile.xml");
SrgsDocument document = null;
GrammarBuilder builder = null;
Grammar grammar = null;

Choices firstThree = new Choices("1", "2", "3");
Choices nextThree = new Choices("4", "5", "6");
Choices lastThree = new Choices("7", "8", "9");

Choices keyPadChoices = new Choices(firstThree, nextThree, lastThree, new Choices("0"));

builder = new GrammarBuilder(keyPadChoices);
document = new SrgsDocument(builder);

document.Mode = SrgsGrammarMode.Dtmf;
grammar = new Grammar(document; 

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

Show: