Share via


Note

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

AudioSignalProblemOccurredEventArgs Class

Provides data for the AudioSignalProblemOccurred event.

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.Speech.Recognition.AudioSignalProblemOccurredEventArgs

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

Syntax

'Declaration
Public Class AudioSignalProblemOccurredEventArgs _
    Inherits EventArgs
'Usage
Dim instance As AudioSignalProblemOccurredEventArgs
public class AudioSignalProblemOccurredEventArgs : EventArgs

Remarks

An instance of AudioSignalProblemOccurredEventArgs is created when the SpeechRecognitionEngine object raises the AudioSignalProblemOccurred event. To obtain information related to the AudioSignalProblemOccurred event, access the following properties in the handler for the event:

The AudioPosition property references the input device's position in its generated audio stream. By contrast, the RecognizerAudioPosition property references the recognizer's position within its audio input. These positions can be different. For more information, see Use Speech Recognition Events (Microsoft.Speech).

The AudioSignalProblem property indicates which problem occurred.

AudioSignalProblemOccurredEventArgs derives from EventArgs.

Examples

The following example defines an event handler that gathers information about an AudioSignalProblemOccurred event.

private SpeechRecognitionEngine sre;

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

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

// Gather information when the AudioSignalProblemOccurred event is raised.
void sre_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.RecognizerAudioPosition);

  // Insert additional event handler code here.
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

AudioSignalProblemOccurredEventArgs Members

Microsoft.Speech.Recognition Namespace

AudioSignalProblem

SpeechRecognitionEngine.AudioSignalProblemOccurred