Export (0) Print
Expand All

SpeechRecognizer.AudioSignalProblemOccurred Event

Occurs when the recognizer encounters a problem in the audio signal.

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

public event EventHandler<AudioSignalProblemOccurredEventArgs> AudioSignalProblemOccurred

To get which problem occurred, use the AudioSignalProblem property of the associated AudioSignalProblemOccurredEventArgs.

When you create a delegate for an AudioSignalProblemOccurred 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 defines an event handler that gathers information about an AudioSignalProblemOccurred event.

private SpeechRecognizer recognizer;

// Initialize the speech recognition engine.
private void Initialize()
{
  recognizer = new SpeechRecognizer();

  // Add a handler for the AudioSignalProblemOccurred event.
  recognizer.AudioSignalProblemOccurred += 
    new EventHandler<AudioSignalProblemOccurredEventArgs>(
      recognizer_AudioSignalProblemOccurred);
}

// Gather information when the AudioSignalProblemOccurred event is raised.
void recognizer_AudioSignalProblemOccurred(object sender, AudioSignalProblemOccurredEventArgs e)
{
  StringBuilder details = new StringBuilder();

  details.AppendLine("Audio signal problem information:");
  details.AppendFormat(
    " Audio level:               {0}" + Environment.NewLine +
    " Audio position:            {1}" + Environment.NewLine +
    " Audio signal problem:      {2}" + Environment.NewLine +
    " Recognition engine audio position: {3}" + Environment.NewLine,
    e.AudioLevel, e.AudioPosition,  e.AudioSignalProblem,
    e.recoEngineAudioPosition);

  // Insert additional event handler code here.
}

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2014 Microsoft