AudioState Enumeration

AudioState Enumeration

Contains a list of possible states for the audio input to a speech recognition engine.

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

public enum AudioState

Member nameDescription
StoppedNot processing audio input.
SilenceReceiving silence or non-speech background noise.
SpeechReceiving speech input.

An AudioStateChanged event is generated whenever the recognition engine's AudioState changes. When the AudioStateChanged event is raised, the AudioState property gets a member of the AudioState enumeration to describe the state of the audio input to the speech recognition engine.

You can obtain the state of the audio input to the speech recognition engine at any time using the SpeechRecognitionEngine.AudioState property.

The following example demonstrates an event handler that handles the changing audio state of a speech recognizer.

private SpeechRecognitionEngine sre;

// Initializes the speech recognition engine.
private void Initialize()
  sre = new SpeechRecognitionEngine();

  // Add a handler for the AudioStateChanged event.
  sre.AudioStateChanged += new EventHandler<AudioStateChangedEventArgs>(sre_AudioStateChanged);

  // Add other initialization code here.

  // Handle the AudioStateChanged event.
  void sre_AudioStateChanged(object sender, AudioStateChangedEventArgs e)
  AudioState newState = e.AudioState;

  // Handle event here.

© 2016 Microsoft