chords
None
unique_notes_in_chords
Collects all unique notes from the given Chords and returns them as a
list, sorted by the the Notes enumeration value.
Example:
>>> unique_notes_in_chords(
... Chord(Note.A, ChordType.Major),
... Chord(Note.A, ChordType.Minor)
... )
[Note.C, Note.Db, Note.E, Note.A]
Args:
*args:
One or more Chord objects to extract notes from.
Returns:
list[Note]:
A list of unique Notes sorted by their value.
Chord
A class representing a musical chord.
Attributes:
root:
The Note the rest of the chord is built from.
type:
A ChordType.
notes:
An array containing the root, 3rd(Major or Minor) & the fifth
Methods:
__init__(self, root, chord_type):
Constructs the chord.
random(cls):
A class method to return a random chord.
__eq__(self, other):
Compares two chords.
notation(self):
Returns the chord's notation without the Note.
quality(self):
An alias for notation. Returns the chord's notation without the Note.
add9(self):
Returns an array of the chord's notes with the added 9th
add11(self):
Returns an array of the chord's notes with the added 11th
add13(self):
Returns an array of the chord's notes with the added 13th
__str__(self):
Returns a string representation of the Chord.
__repr__(self):
Returns a string representation of the Chord.
Chord.__init__
Constructs the chord.
Args:
root:
The root note to build the chord from.
chord_type:
The ChordType to represent the chord.
Returns:
None.
Raises:
ValueError:
If the chord_type is not valid.
Chord.random
A class method that returns a random chord.
e.g. Fdim
Args:
None.
Returns:
A Chord.
Chord.__eq__
Equality operator to check that both the note and chord type match.
e.g. Chord(F, ChordType.Diminished) == Chord(F, ChordType.Diminished)
Args:
other:
The other Chord to compare.
Returns:
A bool. True if this and another chord are the same.
Chord.add9
Returns an array containing the notes of the chord with the added 9th.
e.g. Chord(Note.A).add9() -> [Note.A, Note.Db, Note.E, Note.B]
Args:
None.
Returns:
An array.
Chord.add11
Returns an array containing the notes of the chord with the added 11th.
e.g. Chord(Note.A).add11() -> [Note.A, Note.Db, Note.E, Note.D]
Args:
None.
Returns:
An array.
Chord.add13
Returns an array containing the notes of the chord with the added 13th.
e.g. Chord(Note.A).add13() -> [Note.A, Note.Db, Note.E, Note.Gb]
Args:
None.
Returns:
An array.
Chord.__str__
Returns a string representing the Chord name and type.
e.g. str(Chord(Note.E, ChordType.Dominant7)) -> E7
Args:
None.
Returns:
A string.
Chord.__repr__
Returns a string representing the Chord.
e.g. repr(Chord(Note.E, ChordType.Dominant7)) -> Chord(E, Dominant7)
Args:
None.
Returns:
A string.