Class: VuMeterDisplay

VuMeterDisplay

Simple VU-Meter to used on a signal stream.

Constructor

new VuMeterDisplay(options)

Parameters:
Name Type Description
options Object

Override defaults parameters.

Properties
Name Type Attributes Default Description
offset Number <optional>
-14

dB offset applied to the signal.

min Number <optional>
-80

Minimum displayed value (in dB).

max Number <optional>
6

Maximum displayed value (in dB).

width Number <optional>
6

Width of the display (in pixels).

height Number <optional>
150

Height of the canvas.

container Element | CSSSelector <optional>
null

Container element in which to insert the canvas.

canvas Element | CSSSelector <optional>
null

Canvas element in which to draw.

Source:
Example
import * as lfo from 'waves-lfo/client';

const audioContext = new window.AudioContext();

navigator.mediaDevices
  .getUserMedia({ audio: true })
  .then(init)
  .catch((err) => console.error(err.stack));

function init(stream) {
  const source = audioContext.createMediaStreamSource(stream);

  const audioInNode = new lfo.source.AudioInNode({
    audioContext: audioContext,
    sourceNode: source,
  });

  const vuMeter = new lfo.sink.VuMeterDisplay({
    canvas: '#vu-meter',
  });

  audioInNode.connect(vuMeter);
  audioInNode.start();
}