The context associated with the time value. Used to compute Transport and context-relative timing.
Optional
value: TimeValueThe time value as a number, string or object
Optional
units: FrequencyUnitUnit values
Readonly
contextSet this debug flag to log all events that happen in this class.
Readonly
defaultThe default units
Readonly
nameStatic
versionThe version number semver
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
A4The concert tuning pitch which is used to generate all the other pitch values from notes. A4's values in Hertz.
Takes an array of semitone intervals and returns an array of frequencies transposed by those intervals.
Returns an array of Frequencies
Tone.Frequency("A4").harmonize([0, 3, 7]); // ["A4", "C5", "E5"]
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
Return the value of the frequency as a MIDI note
Tone.Frequency("C4").toMidi(); // 60
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"
Transposes the frequency by the given number of semitones.
A new transposed frequency
Tone.Frequency("A4").transpose(3); // "C5"
Static
ftomConvert a frequency value to a MIDI note.
The value to frequency value to convert.
Static
getStatic
mtofConvert a MIDI note to frequency value.
The midi number to convert.
The corresponding frequency value
Frequency is a primitive type for encoding Frequency values. Eventually all time values are evaluated to hertz using the
valueOf
method.Example