Unit
namespace
BarsBeatsSixteenths
Section titled “BarsBeatsSixteenths”type BarsBeatsSixteenths = `${number}:${number}:${number}`A colon-separated representation of time in the form of Bars:Beats:Sixteenths.
type Cents = numberA Cent is 1/100th of a semitone. e.g. a value of 50 cents would be halfway between two intervals.
Decibels
Section titled “Decibels”type Decibels = numberA number used to measure the intensity of a sound on a logarithmic scale.
Frequency
Section titled “Frequency”type Frequency = Subdivision | Note | string | HertzFrequency can be described similar to time, except ultimately the values are converted to frequency instead of seconds. A number is taken literally as the value in hertz. Additionally any of the Time encodings can be used. Note names in the form of NOTE OCTAVE (i.e. C4) are also accepted and converted to their frequency value.
GainFactor
Section titled “GainFactor”type GainFactor = numberA number representing the multiplication factor applied to a signal
type Hertz = numberHertz are a frequency representation defined as one cycle per second.
Interval
Section titled “Interval”type Interval = numberHalf-step note increments, i.e. 12 is an octave above the root. and 1 is a half-step up.
MidiNote
Section titled “MidiNote”type MidiNote = IntegerRange<128>A number representing a midi note. Integers between 0-127
Milliseconds
Section titled “Milliseconds”type Milliseconds = numberOne millisecond is a thousandth of a second.
type Note = `${Letter}${Accidental}${Octave}`A note in Scientific pitch notation. The pitch class + octave number e.g. “C4”, “D#3”, “G-1”
Samples
Section titled “Samples”type Samples = numberSampling is the reduction of a continuous signal to a discrete signal. Audio is typically sampled 44100 times per second.
Subdivision
Section titled “Subdivision”type Subdivision = "1m" | "1n" | "1n." | `${2 | 4 | 8 | 16 | 32 | 64 | 128 | 256}${"n" | "n." | "t"}` | "0"Represents a subdivision of a measure. The number represents the subdivision. “t” represents a triplet. A “.” add a half. e.g. “4n” is a quarter note, “4t” is a quarter note triplet, and “4n.” is a dotted quarter note.
type Ticks = numberTicks are the basic subunit of the Transport. They are the smallest unit of time that the Transport supports.
type Time = string | Seconds | TimeObject | SubdivisionTime can be described in a number of ways. Read more Time.
- Numbers, which will be taken literally as the time (in seconds).
- Notation, (“4n”, “8t”) describes time in BPM and time signature relative values.
- TransportTime, (“4:3:2”) will also provide tempo and time signature relative times in the form BARS:QUARTERS:SIXTEENTHS.
- Frequency, (“8hz”) is converted to the length of the cycle in seconds.
- Now-Relative, (“+1”) prefix any of the above with “+” and it will be interpreted as “the current time plus whatever expression follows”.
- Object, ({“4n” : 3, “8t” : -1}). The resulting time is equal to the sum of all of the keys multiplied by the values in the object.
- No Argument, for methods which accept time, no argument will be interpreted as “now” (i.e. the currentTime).
TimeObject
Section titled “TimeObject”type TimeObject = { [sub in Subdivision]: number }A time object has a subdivision as the keys and a number as the values.
Tone.Time({
"2n": 1,
"8n": 3
}).valueOf(); // 2n + 8n * 3TimeSignature
Section titled “TimeSignature”type TimeSignature = number | number[]TransportTime
Section titled “TransportTime”type TransportTime = TimeTransportTime describes a position along the Transport’s timeline. It is similar to Time in that it uses all the same encodings, but TransportTime specifically pertains to the Transport’s timeline, which is startable, stoppable, loopable, and seekable. Read more