TimeBaseClass < Type ,  Unit >

  • Type: number
  • Unit: string

TimeBase is a flexible encoding of time which can be evaluated to and from a string.

Hierarchy

Constructor

new TimeBaseClass (
context:BaseContext ,

The context associated with the time value. Used to computeTransport and context-relative timing.

value?:TimeValue ,

The time value as a number, string or object

units?:Unit

Unit values

) => TimeBaseClass

Properties

debug #

boolean

Set this debug flag to log all events that happen in this class.

defaultUnits #

Unit

The default units

disposed #

readonly boolean

Indicates if the instance was disposed. 'Disposing' an instance means that all of the Web Audio nodes that were created for the instance are disconnected and freed for garbage collection.

static version #

string

The version number semver

Methods

dispose #

disconnect and dispose.

dispose ( ) => this

fromType #

Coerce a time type into this units type.

fromType (
type:TimeBaseClass<any , any >

Any time type units

) => this

static getDefaults #

Returns all of the default options belonging to the class.

getDefaults ( ) => BaseToneOptions

toFrequency #

Return the value in hertz

toFrequency ( ) => Hertz

toMidi #

Return the value as a Midi note

toMidi ( ) => MidiNote

toMilliseconds #

Return the time in milliseconds.

toMilliseconds ( ) => Milliseconds

toSamples #

Return the time in samples

toSamples ( ) => Samples

toSeconds #

Return the value in seconds

toSeconds ( ) => Seconds

toString #

Convert the class to a string


const osc = new Tone.Oscillator();
console.log(osc.toString());
toString ( ) => string

toTicks #

Convert the value into ticks

toTicks ( ) => Ticks

valueOf #

Evaluate the time value. Returns the time in seconds.

valueOf ( ) => Type