require('sharp11').chord
Contains a Chord object, which can be created with chord.create()
. Methods of the Chord object do not mutate it, they return a new object.
Returns a Chord object given a string and an optional octave number. The chord
argument should contain the root of the chord, an optional symbol (defaults to major triad), and an optional bass note given in slash notation. Sharp11 supports a wide variety of chord symbols, so anything you'd find in a jazz fake book should be valid here.
Returns the chord name as a string given an argument list of Note objects or strings, ignoring octave numbers. Inversions are supported, so chord.identify('B', 'C', 'Eb', 'G')
returns "CmM7/B".
Invokes .identify()
with the contents of [notes]
as its arguments.
Returns a list of chord names given an argument list of Note objects or strings, ignoring octave numbers. Similar to .identify(notes...)
, but returns all possible matches. Matches are sorted by how "reasonable" they are, with reasonable ones coming first in the list.
Invokes .getPossibleChordNames()
with the contents of [notes]
as its arguments.
Returns true if an object is a Chord.
Chord
objects consist of a root, a chord symbol, and an optional bass (meaning the lowest note in the chord is not the root). The chord symbol is parsed, producing an array of notes that make up the chord. A Chord
object can have an optional octave number, which is applied to the notes of the chord, starting with the first note and increasing accordingly. For example, the notes in a C13 in octave 4 are C4, E4, G4, Bb4, D5, F5, A5. The Chord
constructor is accessible directly as .Chord
, however new instances should be created using .create()
instead.
The chord name, given by the chord
argument in chord.create()
.
A Note object representing the root of the chord.
A string containing the symbol of the chord (no root or bass).
A string containing the symbol of the chord (no root or bass) with aliases replaced, e.g. '-' becomes 'm'.
A Note object representing the bass of the chord.
An array of Note objects representing the notes in the chord, with optional octave numbers.
The (optional) octave number of the chord, i.e., an integer between 0 and 9, or null
.
Returns an array of scale
objects representing scales that could be played over the chord. A scale
can be played over a chord if every note contained in the chord is contained in the scale (with a few optimizations). The returned array of scales is ordered based on a pre-defined "precedence" array, which orders scales based on how commonly used they are.
Returns the first element of the array returned by .scales()
.
Returns the names of the scales
returned by .scales()
.
Transposes the chord, applying note.transpose()
.
Calls .transpose(interval, true)
.
Applies note.clean()
to the root, bass, and every note in the chord.
Returns true if the given note is in the chord, following the rules of note.containedIn()
.
Assigns the chord the given octave number.