Chord class

class Chord

Child class of NoteList, uses same constructor. Is hashable. Contains Note objects, as well as functions to analyze chords. Accepts either a single iterable Notes, or a bunch of Notes. Typically constructed using the inherited functions NoteList.from_ascii() or NoteList.from_midi_list()

chords

Class attribute, dictionary of chord names and semitones from chords.json, exported from https://en.wikipedia.org/wiki/List_of_chords

identify()

Identify what chord this is. Most chords here are valid. https://en.wikipedia.org/wiki/List_of_chords. Returns a list of chord names that match the current Chord object.

Returns:List of chord names in format “note_ascii chord_name”, e.g. “C4 Major”
classmethod from_ident(ident_chord_name)

Used to create a Chord from an identified chord, e.g. ‘C4 Major.

Parameters:ident_chord_name (str) – Chord name similar to what identify() outputs.
Raises:AssertionEror – If ident_chord_name doesn’t have a space in it to separate the chord name from the base.
classmethod from_note_chord(note_obj, chord_name)

Used to create a Chord from a Note and a chord name

Parameters:
  • note_obj (Note) – Note object representing the base note of the chord
  • chord_name (str) – String name of chord, see names of chord in chords.json. e.g. “Major”, or “Harmonic seventh”
Returns:

Chord

classmethod _get_semitones_from_chord_name(chord_name)

Return the 1st semitone from the list of semitones in chords.json for a given chord_name

Parameters:chord_name (str) – String name of chord, see names of chord in chords.json. e.g. “Major”, or “Harmonic seventh”
Returns:Semitones from the base for each note in a chord
Return type:list of ints
Raises:ValueError – When the function can’t find a chord with the chord_name