new Signal(value)
constant audio-rate signal
Tone.Signal is a core component which allows for synchronization of many components.
A single signal can drive multiple parameters by applying Scaling.
For example: to synchronize two Tone.Oscillators in octaves of each other,
Signal --> OscillatorA.frequency
^--> Tone.Multiply(2) --> OscillatorB.frequency
Tone.Signal can be scheduled with all of the functions available to AudioParams
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
value |
number |
<optional> |
(optional) initial value |
Members
-
<private> _syncRatio :number
-
the ratio of the this value to the control signal value
Type:
- number
-
output :GainNode
-
the output node
Type:
- GainNode
-
scalar :GainNode
-
scales the constant output to the desired output
Type:
- GainNode
Methods
-
cancelScheduledValues(startTime)
-
Cancels all scheduled parameter changes with times greater than or equal to startTime.
Parameters:
Name Type Description startTime
Tone.Time -
exponentialRampToValueAtTime(value, endTime)
-
Schedules an exponential continuous change in parameter value from the previous scheduled parameter value to the given value.
Parameters:
Name Type Description value
number endTime
Tone.Time -
exponentialRampToValueNow(value, endTime)
-
Schedules an exponential continuous change in parameter value from the current time and current value to the given value.
Parameters:
Name Type Description value
number endTime
Tone.Time -
getValue() → {number}
-
Returns:
the current value of the signal- Type
- number
-
linearRampToValueAtTime(value, endTime)
-
Schedules a linear continuous change in parameter value from the previous scheduled parameter value to the given value.
Parameters:
Name Type Description value
number endTime
Tone.Time -
linearRampToValueNow(value, endTime)
-
Schedules an linear continuous change in parameter value from the current time and current value to the given value at the given time.
Parameters:
Name Type Description value
number endTime
Tone.Time -
setCurrentValueNow() → {number}
-
creates a schedule point with the current value at the current time
Returns:
the current value- Type
- number
-
setTargetAtTime(value, startTime, timeConstant)
-
Start exponentially approaching the target value at the given time with a rate having the given time constant.
Parameters:
Name Type Description value
number startTime
Tone.Time timeConstant
number -
setValue(value)
-
set the value of the signal right away will be overwritten if there are previously scheduled automation curves
Parameters:
Name Type Description value
number -
setValueAtTime(value, time)
-
Schedules a parameter value change at the given time.
Parameters:
Name Type Description value
number time
Tone.Time -
setValueCurveAtTime(values, startTime, duration)
-
Sets an array of arbitrary parameter values starting at the given time for the given duration.
Parameters:
Name Type Description values
Array.<number> startTime
Tone.Time duration
Tone.Time -
sync(signal)
-
Sync this to another signal and it will always maintain the ratio between the two signals until it is unsynced
Parameters:
Name Type Description signal
Tone.Signal to sync to -
unsync()
-
unbind the signal control will leave the signal value as it was without the influence of the control signal