Tone.Time
↳ EXTENDS Tone.TimeBaseTone.Time is a primitive type for encoding Time values. Eventually all time values are evaluated to seconds using the eval
method. Tone.Time can be constructed with or without the new
keyword. Tone.Time can be passed into the parameter of any method which takes time as an argument.
CONSTRUCTOR
new Tone.Time (The time value.
The units of the value.
EXAMPLE
Methods
.toBarsBeatsSixteenths ( )
#Return the time encoded as Bars:Beats:Sixteenths.
.toNotation ( )
#Convert a Time to Notation. Values will be thresholded to the nearest 128th note.
EXAMPLE
.quantize ( )
#Move the time value towards the quantized value by a percentage.
this
Quantize the time by the given subdivision. Optionally add a percentage which will move the time value towards the ideal quantized value by that percentage.
EXAMPLE
.addNow ( )
#this
Adds the clock time to the time expression at the moment of evaluation.
.sub ( )
#The value to subtract
Optional units to use with the value.
this
Subtract the value from the current time.
EXAMPLE
.clone ( )
#The new cloned Tone.TimeBase
Return a clone of the TimeBase object.
.div ( )
#The value to divide by
Optional units to use with the value.
this
Divide the current value by the given time.
EXAMPLE
.mult ( )
#The value to multiply
Optional units to use with the value.
this
Multiply the current value by the given time.
EXAMPLE
.set ( )
#this
Repalce the current time value with the value given by the expression string.
.add ( )
#The value to add
Optional units to use with the value.
this
Add to the current value.