Tone.TimeBase

↳ EXTENDS Tone

Tone.TimeBase is a flexible encoding of time which can be evaluated to and from a string. Parsing code modified from https://code.google.com/p/tapdigit/ Copyright 2011 2012 Ariya Hidayat, New BSD License

CONSTRUCTOR

new Tone.TimeBase (
val
, [
units
] )
val

The time value as a number or string

type: Time
units

Unit values

type: String
optional

EXAMPLE

Tone.TimeBase(4, "n")
Tone.TimeBase(2, "t")
Tone.TimeBase("2t").add("1m")
Tone.TimeBase("2t + 1m");

Methods

.valueOf ( )

#
↪ returns Seconds

Evaluate the time value. Returns the time in seconds.

</>

.clone ( )

#
↪ returns Tone.TimeBase

The new cloned Tone.TimeBase

Return a clone of the TimeBase object.

</>

.copy ( )

#
time
↪ returns TimeBase

Copies the value of time to this Time

</>

.dispose ( )

#
↪ returns Tone.TimeBase

this

Clean up

</>

.div ( )

#
val

The value to divide by

type: Time
units

Optional units to use with the value.

type: String
optional
↪ returns Tone.TimeBase

this

Divide the current value by the given time.

EXAMPLE

Tone.TimeBase("2m").div(2); //"1m"
</>

.mult ( )

#
val

The value to multiply

type: Time
units

Optional units to use with the value.

type: String
optional
↪ returns Tone.TimeBase

this

Multiply the current value by the given time.

EXAMPLE

Tone.TimeBase("2m").mult("2"); //"4m"
</>

.set ( )

#
exprString
type: String
↪ returns Tone.TimeBase

this

Repalce the current time value with the value given by the expression string.

</>

.sub ( )

#
val

The value to subtract

type: Time
units

Optional units to use with the value.

type: String
optional
↪ returns Tone.TimeBase

this

Subtract the value from the current time.

EXAMPLE

Tone.TimeBase("2m").sub("1m"); //"1m"
</>

.add ( )

#
val

The value to add

type: Time
units

Optional units to use with the value.

type: String
optional
↪ returns Tone.TimeBase

this

Add to the current value.

EXAMPLE

Tone.TimeBase("2m").add("1m"); //"3m"
</>
docs generated Sep 15 2019