Tone.Meter

↳ EXTENDS Tone

Tone.Meter gets the RMS of an input signal with some averaging applied. It can also get the raw value of the signal or the value in dB. For signal processing, it’s better to use Tone.Follower which will produce an audio-rate envelope follower instead of needing to poll the Meter to get the output.

Meter was inspired by Chris Wilsons Volume Meter.

CONSTRUCTOR

new Tone.Meter ( [
channels
= 1 ] , [
smoothing
= 0.8 ] , [
clipMemory
= 0.5 ] )
channels

number of channels being metered

type: number
default: 1
smoothing

amount of smoothing applied to the volume

type: number
default: 0.8
clipMemory

number in seconds that a “clip” should be remembered

type: number
default: 0.5

DEFAULTS

{
smoothing : 0.8 ,
bufferSize : 1024 ,
clipMemory : 0.5 ,
clipLevel : 0.9 ,
channels : 1
}

EXAMPLE

var meter = new Tone.Meter();
var mic = new Tone.Microphone().start();
//connect mic to the meter
mic.connect(meter);
//use getLevel or getDb 
//to access meter level
meter.getLevel();

Members

.clipLevel

↝ Number #

The value above which the signal is considered clipped.

</>

.clipMemory

↝ Time #

The amount of time a clip is remember for.

</>

.smoothing

↝ NormalRange #

The amount which the decays of the meter are smoothed. Small values will follow the contours of the incoming envelope more closely than large values.

</>

Methods

.dispose ( )

#
↪ returns Tone.Meter

this

Clean up.

</>

.getDb ( )

#
channel
type: number
optional
↪ returns Decibels

Get the volume of the signal in dB

</>

.getLevel ( )

#
channel

which channel

type: number
default: 0
↪ returns number

the value

Get the rms of the signal.

</>

.getValue ( )

#
channel
type: number
optional
↪ returns number

Get the raw value of the signal.

</>

.isClipped ( )

#
↪ returns boolean

if the audio has clipped. The value resets based on the clipMemory defined.

</>
docs generated Sep 15 2019