Tone.Frequency

↳ EXTENDS Tone.TimeBase

Tone.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"]
</>

.toTicks ( )

#
↪ returns Ticks

Return the duration of one cycle in ticks

</>

.transpose ( )

#
interval
↪ returns Tone.Frequency

A new transposed frequency

Transposes the frequency by the given number of semitones.

EXAMPLE

Tone.Frequency("A4").transpose(3); //"C5"
</>

.toFrequency ( )

#
↪ returns Frequency

Return the value in Hertz

</>

.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"
</>

.toSeconds ( )

#
↪ returns Seconds

Return the duration of one cycle in seconds.

</>
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.

</>
inherited from Tone.TimeBase

.toSamples ( )

#
↪ returns Samples

Return the time in samples

</>
inherited from Tone.TimeBase

.dispose ( )

#
↪ returns Tone.TimeBase

this

Clean up

</>

Static Methods

.mtof ( )

#
midi

The midi number to convert.

type: MIDI
↪ returns Frequency

the corresponding frequency value

Convert a MIDI note to frequency value.

EXAMPLE

Tone.Frequency.mtof(69); // returns 440
</>

.ftom ( )

#
frequency

The value to frequency value to convert.

↪ returns MIDI

Convert a frequency value to a MIDI note.

EXAMPLE

Tone.Frequency.ftom(440); // returns 69
</>
docs generated Sep 15 2019