utils/notes

Methods

(static) freq2cents(frequency, baseopt) → {number}

Source:

Returns the percents a frequency misses a real note by.

Parameters:
Name Type Attributes Description
frequency number

The frequency to translate.

base number <optional>

The frequency of A440.

Returns:

cents - The percent of the difference to the next full note.

Type
number

(static) freq2midi(frequency, baseopt) → {int}

Source:

Returns a MIDI note number for a frequency.

Parameters:
Name Type Attributes Description
frequency number

The frequency to translate.

base number <optional>

The frequency of A440.

Returns:

number - The MIDI number of the frequency.

Type
int

(static) freq2note(frequency, baseopt) → {string}

Source:

Returns a note name for a frequency.

Parameters:
Name Type Attributes Description
frequency number

The frequency to translate.

base number <optional>

The frequency of A440.

Returns:

note - The name of the note.

Type
string

(static) midi2freq(note) → {number}

Source:

Returns a frequency of a MIDI note number.

Parameters:
Name Type Description
note int

The MIDI note to translate.

Returns:

frequency - The frequency of the MIDI number.

Type
number

(static) midi2note(note) → {string}

Source:

Returns a note name for a MIDI note number.

Parameters:
Name Type Description
note int

The MIDI note to translate.

Returns:

note - The name of the note.

Type
string