Note API - Attibee/Lyre-Note GitHub Wiki

Note( note )

Handles the creation and manipulationg of Western music notes.

Constructor

new Note( note )

Sets the note from a string. Case insensitive.

Params:

name type description
note string Case insensitive note string such as C, Ab and G#.

Line: Note.js, line 14

Methods

getFlat( ) → {string}

Returns the flat representation of the note.

Returns:

The flat note.

Line: Note.js, line 94

getOctave( ) → {integer}

Gets the note's octave.

Returns:

The octave integer, such as C4 for middle C.

Line: Note.js, line 59

getSharp( ) → {string}

Returns the sharp representation of the note.

Returns:

The sharp note.

Line: Note.js, line 104

getTransposition( halfSteps ) → {Note}

Gets a new Note transposed to the specificed half steps. If the current note is flat, it returns flat, otherwise sharp is returned.

Returns:

If the current note is flat, it will return a flat note, else sharp is returned.

Params:

name type description
halfSteps int The amount of half steps. Negative numbers transpose down, positives transpose up.

Line: Note.js, line 125

isFlat( ) → {Boolean}

Returns true if note is flat.

Returns:

True if the note is flat.

Line: Note.js, line 75

isNatural( ) → {boolean}

Returns true if the note is natural, ie it has no sharps or flats.

Returns:

true if no sharps or flats, else false.

Line: Note.js, line 114

isSharp( ) → {Boolean}

Returns true if the note is sharp.

Returns:

True if the note is sharp.

Line: Note.js, line 67

isValid( note ) → {boolean}

Checks if a note is valid. Case sensitive.

Returns:

True if the note is valid, else false.

Params:

name type description
note string String representation of a note, such as C, Ab and G#.

Line: Note.js, line 85

setNote( note )

Sets the note from a string. Case insensitive.

Params:

name type description
note string Case insensitive note string such as C, Ab and G#.

Line: Note.js, line 23

setOctave( n )

Sets the nth octave of the note.

Params:

name type description
n integer The octave integer, such as C4 for middle C.

Line: Note.js, line 51

toString( ) → {String}

Converst the Note to its string.

Returns:

The note string.

Line: Note.js, line 158

transpose( halfSteps ) → {Note}

Transposes the current note to the specified half steps. If the current note is flat, it returns flat, otherwise sharp is returned.

Returns:

Returns self.

Params:

name type description
halfSteps integer The amount of half steps. Negative numbers transpose down, positives transpose up.

Line: Note.js, line 148