Class VUMeterMaxSampleEventArgs
- Namespace
- VisioForge.Core.Types
- Assembly
- VisioForge.Core.dll
Provides data for events that report the minimum and maximum audio sample values for peak level monitoring.
public class VUMeterMaxSampleEventArgs : EventArgsInheritance
Inherited Members
Remarks
This event argument is essential for implementing peak meters, clipping indicators, and dynamic range monitoring in audio applications. It reports the extreme sample values detected within a specific time window, allowing applications to monitor signal peaks and detect potential audio issues.
Common uses include: - Peak level meters with hold functionality - Clipping detection and warning systems - Dynamic range measurement - Automatic gain control (AGC) systems - Audio normalization and leveling
Audio samples are typically normalized to the range [-1.0, 1.0], where: - 0.0 represents silence - 1.0 represents maximum positive amplitude (0 dBFS) - -1.0 represents maximum negative amplitude (0 dBFS) - Values exceeding ±1.0 indicate clipping (distortion)
Constructors
VUMeterMaxSampleEventArgs(float, float)
Initializes a new instance of the VisioForge.Core.Types.VUMeterMaxSampleEventArgs class with the specified minimum and maximum sample values.
public VUMeterMaxSampleEventArgs(float minValue, float maxValue)Parameters
minValuefloat-
The minimum sample value detected in the audio stream. Expected range is typically [-1.0, 0.0] for normalized audio, where -1.0 represents maximum negative amplitude.
maxValuefloat-
The maximum sample value detected in the audio stream. Expected range is typically [0.0, 1.0] for normalized audio, where 1.0 represents maximum positive amplitude.
Remarks
Sample values outside the range [-1.0, 1.0] indicate clipping or improper gain staging. Applications should monitor for values approaching or exceeding these limits to prevent audio distortion.
The time window for detecting these extremes depends on the implementation but is typically synchronized with the audio buffer processing rate (e.g., every 10-50ms).
Properties
MaxSample
Gets the maximum sample value detected by the VU meter within the measurement window.
public float MaxSample { get; }Property Value
Remarks
To convert to decibels (dBFS):
float dBFS = 20.0f * (float)Math.Log10(Math.Abs(MaxSample));
Where 0 dBFS corresponds to a sample value of 1.0.
MinSample
Gets the minimum sample value detected by the VU meter within the measurement window.
public float MinSample { get; }Property Value
Remarks
The absolute value of MinSample can be used together with MaxSample to determine the overall peak level:
float peakLevel = Math.Max(Math.Abs(MinSample), Math.Abs(MaxSample));