SpeechRecognizer.AudioLevelUpdated Event

Occurs when the shared recognizer reports the level of its audio input.

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

public event EventHandler<AudioLevelUpdatedEventArgs> AudioLevelUpdated

The recognizer raises this event multiple times per second. The frequency with which the event is raised depends on the computer on which the application is running.

To get the audio level at the time of the event, use the AudioLevel property of the associated AudioLevelUpdatedEventArgs. To get the current audio level of the input to the recognizer, use the recognizer's AudioLevel property.

When you create a delegate for an AudioLevelUpdated event, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Events and Delegates.

The following example adds a handler for the AudioLevelUpdated event to a SpeechRecognizer object. The handler outputs the new audio level to the console.

private SpeechRecognizer recognizer;

// Initialize the SpeechRecognizer object. 
private void Initialize()
{
  recognizer = new SpeechRecognizer();
 
  // Add an event handler for the AudioLevelUpdated event.
  recognizer.AudioLevelUpdated += 
    new EventHandler<AudioLevelUpdatedEventArgs>(recognizer_AudioLevelUpdated);

  // Add other initialization code here.

}

// Write the audio level to the console when the AudioLevelUpdated event is raised.
void recognizer_AudioLevelUpdated(object sender, AudioLevelUpdatedEventArgs e)
{
  Console.WriteLine("The audio level is now: {0}.", e.AudioLevel);
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft