Tone.Frequency
↳ EXTENDS Tone.TimeBaseTone.Frequency is a primitive type for encoding Frequency values. Eventually all time values are evaluated to hertz using the eval
method.
CONSTRUCTOR
new Tone.Frequency (val
, [ units
]
)
val
The time value.
type:
String
or
Number
units
The units of the value.
type:
String
optional
EXAMPLE
Tone.Frequency("C3") // 261
Tone.Frequency(38, "midi") //
Tone.Frequency("C3").transpose(4);
Methods
.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"]
.transpose ( )
#
interval
type:
Interval
↪ returns
Tone.Frequency
A new transposed frequency
Transposes the frequency by the given number of semitones.
EXAMPLE
Tone.Frequency("A4").transpose(3); //"C5"
.toMidi ( )
#
↪ returns
MIDI
Return the value of the frequency as a MIDI note
EXAMPLE
Tone.Frequency("C4").toMidi(); //60
.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.