Chord

new Chord(array notes, object descriptor, Note tonic, boolean relative, string type)

the MUSIQ.js chord class
Parameters:
Name Type Argument Default Description
notes array a simple array of integers representing the midi notes
descriptor object an object describing the chord
tonic Note the current tonic Note oject
relative boolean <optional>
false if the chord should be interpreted as relative, i.e. can be positioned anywhere on the musical scale (Fretboard for guitar)
type string <optional>
chord the type of chord,
Source:

Methods

<static> contains(Chord chord, Note note) → boolean

check if this chord contains a certain note if the Chord is relative, the relative position of the Note is taken
Parameters:
Name Type Description
chord Chord a Chord object
note Note a Note object
Source:
Returns:
true when the Chord contains the specific note
Type
boolean

<static> fromNotation(string name, string type)Chord

constructs a Chord object from a notation like Cmaj7
Parameters:
Name Type Argument Default Description
name string the chord name
type string <optional>
chord the chord type, can be 'chord' or 'scale'
Source:
Returns:
Type
Chord

<static> fromNotes(array notes, integer inversion)Chord

build a chord from individual notes these can be note objects or just a list of integers
Parameters:
Name Type Argument Default Description
notes array a simple array of integer notes
inversion integer <optional>
0 the number of the inversion, 0 = root position, 1 = first inversion, 2 = second inversion, ...
Source:
Returns:
a matching chord, null when nothing is found
Type
Chord

contains(Note note) → boolean

check if a Chord contains a note
Parameters:
Name Type Description
note Note a Note object
Source:
Returns:
true if the chord contains the note
Type
boolean

hasName(string name) → boolean

check if the chord can be described by a simple name
Parameters:
Name Type Description
name string a possible way to describe the chord, i.e. 'Cmaj', 'D#min' 'dim', etc. - should support both # and b, ♭ and ♯
Source:
Returns:
true if the chord can be described by this name
Type
boolean

longNotation(integer signature)

get the name of the chord in long, readable notation
Parameters:
Name Type Description
signature integer the signature of the note
Source:

minNotes() → array

the minimal notes needed to form this chord
Source:
Returns:
the notes that are minimally necessary to form this chord (without optional notes)
Type
array

notation(integer signature) → string

get the chord in proper notation these are examples of proper notations: C - an relative C chord C# - a C sharp chord B♭6 - A Bb7 chord Cmin7 - A cminor chord
Parameters:
Name Type Description
signature integer the signature of the note
Source:
Returns:
- the chord notation as it is most commonly used
Type
string

noteObjects() → array

Source:
Returns:
An array of Note objects, all absolute save it in a local variable _notes for easy access
Type
array

toString() → string

a simple toString function that gives us the notation of all the notes
Source:
Returns:
Type
string

transpose(Interval interval)

transpose a chord with a certain interval and return the new transposed chord
Parameters:
Name Type Description
interval Interval an Interval object
Source:

type() → string

Source:
Returns:
representing the type, can be 'chord', 'scale'
Type
string