Tone.Midi
↳ EXTENDS Tone.FrequencyTone.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 (The time value.
The units of the value.
EXAMPLE
var t = Tone.Midi("4n");//a quarter note
Methods
.transpose ( )
#A new transposed frequency
Transposes the frequency by the given number of semitones.
EXAMPLE
Tone.Frequency("A4").transpose(3); //"C5"
.toMidi ( )
#Return the value of the frequency as a MIDI note
EXAMPLE
Tone.Midi(60).toMidi(); //60
.toFrequency ( )
#Return the value of the frequency as a MIDI note
EXAMPLE
Tone.Midi(60).toMidi(); //60
.toSeconds ( )
#Return the duration of one cycle in seconds.
.toTicks ( )
#Return the duration of one cycle in ticks
.harmonize ( )
#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"]
.toNote ( )
#Return the value of the frequency in Scientific Pitch Notation
EXAMPLE
Tone.Frequency(69, "midi").toNote(); //"A4"
.valueOf ( )
#Evaluate the time value. Returns the time in seconds.
.toMilliseconds ( )
#Return the time in milliseconds.