Share via


SpeechRecognitionAudioLevelChangedEventArgs.AudioLevel property

 

The AudioLevel property returns the current level of the user's speaking volume as detected by the SpeechRecognizer instance.

Syntax

public double AudioLevel { get; }

Property Value

Type: System.Double

The audio level 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