Partager via


SpeechRecognitionAudioLevelChangedEventArgs class

 

The SpeechRecognitionAudioLevelChangedEventArgs class makes the new audio level available to the SpeechRecognizer.AudioLevelChanged event.

Syntax

public class SpeechRecognitionAudioLevelChangedEventArgs : EventArgs

The SpeechRecognitionAudioLevelChangedEventArgs class has the following members.

Properties

Name

Description

AudioLevel

The current audio level of user speech.

Example

The following event handler adjusts the opacity of a UI element named VolumeMeter in response to changes in speaking volume.

void SR_AudioLevelChanged(SpeechRecognizer sender,
    SpeechRecognitionAudioLevelChangedEventArgs args)
{
    var v = args.AudioLevel;
    if (v > 0) VolumeMeter.Opacity = v / 50;
    else VolumeMeter.Opacity = Math.Abs((v - 50) / 100);
}
function SR_AudioLevelChanged(args) {
    var volumeMeter = document.getElementById("VolumeMeter");
    var v = args.audioLevel;
    if (v > 0) volumeMeter.style.opacity = v / 50;
    else volumeMeter.style.opacity = Math.abs((v - 50) / 100);
}

Requirements

Minimum Supported Client

Windows 8

Required Extensions

Bing.Speech

Namespace

Bing.Speech