Skip to content
Tone.js

Meter

class Component ↳ extends MeterBase<MeterOptions>

Meter gets the RMS of an input signal. It can also get the raw value of the input signal. Setting normalRange to true will covert the output to a range of 0-1. See an example using a graphical display here.

const meter = new Tone.Meter();
const mic = new Tone.UserMedia();
mic.open();
// connect mic to the meter
mic.connect(meter);
// the current level of the mic
setInterval(() => console.log(meter.getValue()), 100);

See also: DCMeter.

new Meter(smoothing?: number)

Parameters

  • smoothing number optional

    The amount of smoothing applied between frames.

new Meter(options?: Partial<MeterOptions>)

Parameters

↳ inherited from MeterBase

input: InputNode

The signal to be analysed

read-only

name: string

The name of the class

Default: "Meter"

normalRange: boolean

If the output should be in decibels or normal range between 0-1. If normalRange is false, the output range will be the measured decibel value, otherwise the decibel value will be converted to the range of 0-1

↳ inherited from MeterBase

output: OutputNode

The output is just a pass through of the input

smoothing: number

A value from between 0 and 1 where 0 represents no time averaging with the last analysis frame.

read-only

channels: number

The number of channels of analysis.

dispose(): this

Dispose and disconnect

Returns this

getValue(): number | number[]

Get the current value of the incoming signal. Output is in decibels when normalRange is false. If channels = 1, then the output is a single number representing the value of the input signal. When channels > 1, then each channel is returned as a value in a number array.

Returns number | number[]

static

getDefaults(): MeterOptions

Returns all of the default options belonging to the class.

Returns MeterOptions

getLevel(): number | number[]

Use getValue instead. For the previous getValue behavior, use DCMeter.

Returns number | number[]