Audio levels and VU-meters




Audio levels and VU-meters


Audio levels

The audio levels are returned by the OnAudioPeak event (type TOnAudioPeak) when the AudioPeakEvent property is enabled.

The event returns the peak values of the left and right channels in percentage or in DB.


VU-Meters are integrated in the component (analog or bargraph) and can be easily displayed.

Proceed as follows:

1. put 2 panel (or image) controls on the form, one for the left channel, one for the right channel. Let's suppose they are named Panel1 and Panel2.

2. set VUMeter = vu_Analog (or vu_Bargraph)

3. assign the handle of the panel (or the image) controls as follows:

VideoGrabber.SetVUMeterSetting(VU_LEFT, vu_Handle, Panel1.Handle)
VideoGrabber.SetVUMeterSetting(VU_RIGHT, vu_Handle, Panel2.Handle)

4. you can adjust the other VU-Meter settings (mainly colors), if needed, by invoking SetVUMeterSetting.

to detach the VU-Meters from their panel (or image) controls, invoke:

VideoGrabber.SetVUMeterSetting(VU_LEFT, vu_Handle, 0)
VideoGrabber.SetVUMeterSetting(VU_RIGHT, vu_Handle, 0)

VU-meters and bargraphs overlayed over the video frames

Up to 6 vu-meters/bargraphs are availables (from index 0 to 5).

(for backward compatibility the VUMeter property is kept but it activates only the VUMeters 0 and 1)

Additionally, now the VU-Meters and bargraphs can display custom values updated in real-time, the custom values must be in the 0..100 range.

To activate any of the 6 VU-meters, instead of setting the VUMeter property, invoke SetVUMeter_Enabled. E.g. to activate a bargraph, invoke SetVUMeter_Enabled(index, vu_BargraphOverlay)

So is is possible to use;

- the 2 originals VU-meters (index 0 and 1)

- 2 additional VU-meters or bargraphs (index 2 and 3) that can display audio or custom values

- 2 additional VU-meters or bargraphs (index 4 and 5) that can display custom values ONLY

Example to activate the bargraphs 2 and 3:

VideoGrabber.SetVUMeter_Enabled(2, vu_BargraphOverlay);

VideoGrabber.SetVUMeterSetting(2, vu_Transparent, 0);

VideoGrabber.SetVUMeterSetting(2, vu_OverlayLeft, 10);

VideoGrabber.SetVUMeterSetting(2, vu_OverlayTop, 10);

VideoGrabber.SetVUMeterSetting(2, vu_OverlayWidth, 100);

VideoGrabber.SetVUMeterSetting(2, vu_OverlayHeight, 60);

VideoGrabber.SetVUMeter_Enabled(3, vu_BargraphOverlay);

VideoGrabber.SetVUMeterSetting(3, vu_Transparent, 0);

VideoGrabber.SetVUMeterSetting(3, vu_OverlayLeft, 200);

VideoGrabber.SetVUMeterSetting(3, vu_OverlayTop, 500);

VideoGrabber.SetVUMeterSetting(3, vu_OverlayWidth, 100);

VideoGrabber.SetVUMeterSetting(3, vu_OverlayHeight, 60);

and to use the bargraph 3 as custom bargraph:

VideoGrabber.SetVUMeterSetting(3, vu_CustomPercentValue, 40); // e.g. for 40%

Note: to customize the VU-meter or bargraph foreground and background color, pass the color as RGB hexadecimal value, e.g.:


SetVUMeterSetting(2, VidGrab.TVUMeterSetting.vu_NormalColor, $FFFF00)


SetVUMeterSetting(2, VidGrab.TVUMeterSetting.vu_NormalColor, 0xFFFF00)


SetVUMeterSetting(2, VidGrab.TVUMeterSetting.vu_NormalColor, CType(&Hffff00, IntPtr))

See Also
TVUMeter TVUMeterSetting AudioBalance AudioChannelRenderMode AudioVolume MuteAudioRendering SpeakerBalance SpeakerControl SpeakerVolume VUMeter