Midi is a primitive type for encoding Time values.
Midi can be constructed with or without the new
keyword. Midi can be passed
into the parameter of any method which takes time as an argument.
The context associated with the time value. Used to computeTransport and context-relative timing.
The concert tuning pitch which is used to generate all the other pitch values from notes. A4's values in Hertz.
Set this debug flag to log all events that happen in this class.
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.
The version number semver
disconnect and dispose.
Coerce a time type into this units type.
Convert a frequency value to a MIDI note.
Returns all of the default options belonging to the class.
Takes an array of semitone intervals and returns an array of frequencies transposed by those intervals.
Tone.Frequency("A4").harmonize([0, 3, 7]); // ["A4", "C5", "E5"]
Convert a MIDI note to frequency value.
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.
Tone.Time(21).quantize(2); // returns 22
Tone.Time(0.6).quantize("4n", 0.5); // returns 0.55
Move the time value towards the quantized value by a percentage.
Return the time encoded as Bars:Beats:Sixteenths.
Return the value of the frequency as a MIDI note
Tone.Midi(60).toFrequency(); // 261.6255653005986
Return the value of the frequency as a MIDI note
Tone.Midi(60).toMidi(); // 60
Return the time in milliseconds.
Convert a Time to Notation. The notation values are will be the closest representation between 1m to 128th note.
// if the Transport is at 120bpm:
Tone.Time(2).toNotation(); // returns "1m"
Return the value of the frequency in Scientific Pitch Notation
Tone.Frequency(69, "midi").toNote(); // "A4"
Return the time in samples
Return the duration of one cycle in seconds.
Convert the class to a string
const osc = new Tone.Oscillator();
console.log(osc.toString());
Return the duration of one cycle in ticks
Transposes the frequency by the given number of semitones.
Tone.Midi("A4").transpose(3); // "C5"
Evaluate the time value. Returns the time in seconds.