Compartir a través de


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

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)

Syntax

'Declaration
Public Enumeration AudioState
'Usage
Dim instance As AudioState
public enum AudioState

Members

Member name Description
Stopped Not processing audio input.
Silence Receiving silence or non-speech background noise.
Speech Receiving speech input.

Remarks

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.

Examples

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.
}

See Also

Reference

Microsoft.Speech.Recognition Namespace

AudioState

AudioStateChanged

AudioStateChangedEventArgs