Tone.Midi

↳ EXTENDS Tone.Frequency

Tone.Midi is a primitive type for encoding Time values. Tone.Midi can be constructed with or without the new keyword. Tone.Midi can be passed into the parameter of any method which takes time as an argument.

CONSTRUCTOR

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

The time value.

type: String or Number
units

The units of the value.

type: String
optional

EXAMPLE

var t = Tone.Midi("4n");//a quarter note

Methods

.transpose ( )

#
interval
↪ returns Tone.Frequency

A new transposed frequency

Transposes the frequency by the given number of semitones.

EXAMPLE

Tone.Midi("A4").transpose(3); //"C5"
</>

.toMidi ( )

#
↪ returns MIDI

Return the value of the frequency as a MIDI note

EXAMPLE

Tone.Midi(60).toMidi(); //60
</>

.toFrequency ( )

#
↪ returns MIDI

Return the value of the frequency as a MIDI note

EXAMPLE

Tone.Midi(60).toFrequency(); //261.6255653005986
</>
inherited from Tone.Frequency

.toSeconds ( )

#
↪ returns Seconds

Return the duration of one cycle in seconds.

</>
inherited from Tone.Frequency

.toTicks ( )

#
↪ returns Ticks

Return the duration of one cycle in ticks

</>
inherited from Tone.Frequency

.harmonize ( )

#
intervals
type: Array
↪ returns Array.

Returns an array of Frequencies

Takes an array of semitone intervals and returns an array of frequencies transposed by those intervals.

EXAMPLE

Tone.Frequency("A4").harmonize([0, 3, 7]); //["A4", "C5", "E5"]
</>
inherited from Tone.Frequency

.toNote ( )

#
↪ returns Note

Return the value of the frequency in Scientific Pitch Notation

EXAMPLE

Tone.Frequency(69, "midi").toNote(); //"A4"
</>
inherited from Tone.TimeBase

.valueOf ( )

#
↪ returns Seconds

Evaluate the time value. Returns the time in seconds.

</>
inherited from Tone.TimeBase

.toMilliseconds ( )

#
↪ returns Milliseconds

Return the time in milliseconds.

</>
inherited from Tone.TimeBase

.toSamples ( )

#
↪ returns Samples

Return the time in samples

</>
inherited from Tone.TimeBase

.dispose ( )

#
↪ returns Tone.TimeBase

this

Clean up

</>
docs generated Sep 15 2019