Tone.Signal

↳ EXTENDS Tone.Param

A signal is an audio-rate value. Tone.Signal is a core component of the library. Unlike a number, Signals can be scheduled with sample-level accuracy. Tone.Signal has all of the methods available to native Web Audio AudioParam as well as additional conveniences. Read more about working with signals here.

CONSTRUCTOR

new Tone.Signal ( [
value
] , [
units
= Number ] )
value

Initial value of the signal. If an AudioParam is passed in, that parameter will be wrapped and controlled by the Signal.

type: Number or AudioParam
optional
units

unit The units the signal is in.

type: string
default: Number

DEFAULTS

{
value : 0 ,
units : Tone.Type.Default ,
convert : true
}

EXAMPLE

var signal = new Tone.Signal(10);

Members

inherited from Tone.AudioNode

.numberOfOutputs

Number READONLY #

The number of outputs coming out of the AudioNode.

</>
inherited from Tone.AudioNode

.channelInterpretation

String READONLY #

channelInterpretation determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. The default value is “speakers”.

</>
inherited from Tone.AudioNode

.channelCount

Number READONLY #

channelCount is the number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined.

</>
inherited from Tone.AudioNode

.context

Tone.Context READONLY #

Get the audio context belonging to this instance.

</>
inherited from Tone.AudioNode

.channelCountMode

String READONLY #

channelCountMode determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node. The default value is “max”. This attribute has no effect for nodes with no inputs.

</>
inherited from Tone.AudioNode

.numberOfInputs

Number READONLY #

The number of inputs feeding into the AudioNode. For source nodes, this will be 0.

</>
inherited from Tone.Param

.value

Number #

The current value of the parameter.

</>
inherited from Tone.Param

.convert

Boolean #

If the value should be converted or not

</>
inherited from Tone.Param

.units

Tone.Type #

The units of the parameter

</>

Methods

.getValueAtTime ( )

#
time

When to get the signal value

type: Time
↪ returns Number

Return the current signal value at the given time.

</>

.dispose ( )

#
↪ returns Tone.Signal

this

dispose and disconnect

</>
inherited from Tone.AudioNode

.connect ( )

#
outputNum

optionally which output to connect from

type: number
default: 0
inputNum

optionally which input to connect to

type: number
default: 0
↪ returns Tone.AudioNode

this

connect the output of a ToneNode to an AudioParam, AudioNode, or ToneNode

</>
inherited from Tone.AudioNode

.disconnect ( )

#
output

Either the output index to disconnect if the output is an array, or the node to disconnect from.

↪ returns Tone.AudioNode

this

disconnect the output

</>
inherited from Tone.AudioNode

.toMaster ( )

#
↪ returns Tone.AudioNode

this

Connect ‘this’ to the master output. Shorthand for this.connect(Tone.Master)

EXAMPLE

//connect an oscillator to the master output
var osc = new Tone.Oscillator().toMaster();
</>
inherited from Tone.AudioNode

.chain ( )

#
nodes
↪ returns Tone.AudioNode

this

Connect the output of this node to the rest of the nodes in series.

EXAMPLE

//connect a node to an effect, panVol and then to the master output
 node.chain(effect, panVol, Tone.Master);
 
</>
inherited from Tone.AudioNode

.fan ( )

#
nodes
↪ returns Tone.AudioNode

this

connect the output of this node to the rest of the nodes in parallel.

</>
inherited from Tone.Param

.exponentialApproachValueAtTime ( )

#
value

The value to ramp to.

type: number
time

When the ramp should start.

type: Time
rampTime

the time that it takes the value to ramp from it’s current value

type: Time
↪ returns Tone.Param

this

Start exponentially approaching the target value at the given time. Since it is an exponential approach it will continue approaching after the ramp duration. The rampTime is the time that it takes to reach over 99% of the way towards the value. This methods is similar to setTargetAtTime except the third argument is a time instead of a ‘timeConstant’

EXAMPLE

//exponentially ramp to the value 2 over 4 seconds.
signal.exponentialRampTo(2, 4);
</>
inherited from Tone.Param

.exponentialRampToValueAtTime ( )

#
value
type: number
endTime
type: Time
↪ returns Tone.Param

this

Schedules an exponential continuous change in parameter value from the previous scheduled parameter value to the given value.

</>
inherited from Tone.Param

.cancelAndHoldAtTime ( )

#
time
type: Time
↪ returns Tone.Param

this

This is similar to cancelScheduledValues except it holds the automated value at time until the next automated event.

</>
inherited from Tone.Param

.cancelScheduledValues ( )

#
time
type: Time
↪ returns Tone.Param

this

Cancels all scheduled parameter changes with times greater than or equal to startTime.

</>
inherited from Tone.Param

.linearRampTo ( )

#
value

The value to ramp to.

type: number
rampTime

the time that it takes the value to ramp from it’s current value

type: Time
startTime

When the ramp should start.

type: Time
default: now
↪ returns Tone.Param

this

Schedules an linear continuous change in parameter value from the current time and current value to the given value over the duration of the rampTime.

EXAMPLE

//linearly ramp to the value 4 over 3 seconds.
signal.linearRampTo(4, 3);
</>
inherited from Tone.Param

.linearRampToValueAtTime ( )

#
value
type: number
endTime
type: Time
↪ returns Tone.Param

this

Schedules a linear continuous change in parameter value from the previous scheduled parameter value to the given value.

</>
inherited from Tone.Param

.rampTo ( )

#
value
type: number
rampTime

The time that it takes the value to ramp from it’s current value

type: Time
startTime

When the ramp should start.

type: Time
default: now
↪ returns Tone.Param

this

Ramps to the given value over the duration of the rampTime. Automatically selects the best ramp type (exponential or linear) depending on the units of the signal

EXAMPLE

//ramp to the value either linearly or exponentially
//depending on the "units" value of the signal
signal.rampTo(0, 10);
 

EXAMPLE

//schedule it to ramp starting at a specific time
signal.rampTo(0, 10, 5)
</>
inherited from Tone.Param

.setRampPoint ( )

#
now

(Optionally) pass the now value in.

type: number
optional
↪ returns Tone.Param

this

Creates a schedule point with the current value at the current time. This is useful for creating an automation anchor point in order to schedule changes from the current value.

</>
inherited from Tone.Param

.setTargetAtTime ( )

#
value
type: number
startTime
type: Time
timeConstant
type: number
↪ returns Tone.Param

this

Start exponentially approaching the target value at the given time with a rate having the given time constant.

</>
inherited from Tone.Param

.setValueAtTime ( )

#
value

The value to set the signal.

type: *
time

The time when the change should occur.

type: Time
↪ returns Tone.Param

this

Schedules a parameter value change at the given time.

EXAMPLE

//set the frequency to "G4" in exactly 1 second from now.
freq.setValueAtTime("G4", "+1");
</>
inherited from Tone.Param

.setValueCurveAtTime ( )

#
values
type: Array
startTime
type: Time
duration
type: Time
scaling

If the values in the curve should be scaled by some value

default: 1
↪ returns Tone.Param

this

Sets an array of arbitrary parameter values starting at the given time for the given duration.

</>
inherited from Tone.Param

.targetRampTo ( )

#
value

The value to ramp to.

type: number
rampTime

the time that it takes the value to ramp from it’s current value

type: Time
startTime

When the ramp should start.

type: Time
default: now
↪ returns Tone.Param

this

Start exponentially approaching the target value at the given time. Since it is an exponential approach it will continue approaching after the ramp duration. The rampTime is the time that it takes to reach over 99% of the way towards the value.

EXAMPLE

//exponentially ramp to the value 2 over 4 seconds.
signal.exponentialRampTo(2, 4);
</>
inherited from Tone.Param

.exponentialRampTo ( )

#
value

The value to ramp to.

type: number
rampTime

the time that it takes the value to ramp from it’s current value

type: Time
startTime

When the ramp should start.

type: Time
default: now
↪ returns Tone.Param

this

Schedules an exponential continuous change in parameter value from the current time and current value to the given value over the duration of the rampTime.

EXAMPLE

//exponentially ramp to the value 2 over 4 seconds.
signal.exponentialRampTo(2, 4);
</>
docs generated Sep 15 2019