musicaiz.harmony.Chord¶
- class musicaiz.harmony.Chord(chord: Optional[str] = None)[source]¶
- __init__(chord: Optional[str] = None)[source]¶
The Chord object can be initialized with a valid chord name or not. The logic behind this is having methods for generating and analyzing data.
- Initialization:
- By initializing this class with a chord name, the use of this class’ methods
will be to generate data with the chord information.
- By initializing this class with no input arguments, the use of this class’ methods
is more related to analize data (predict chords…).
- Raises
- ValueError
if input chord name is invalid.
Methods
__init__
([chord])The Chord object can be initialized with a valid chord name or not.
chords_to_onehot
()Converts the chords to a one hot representation.
get_all_chords
()Constructs a dictionaray with the chord name (key) and its constructor (value).
get_notes
([inversion])Given the chord name and the root note, return all the notes in the chord. Arguments --------- inversion: int The chord inversion that will determined the notes order in the output list.
get_notes_from_chord
(tonic, quality)Generates the list of note objects that correspond to a chord.
get_pitches_from_chord
(tonic, quality, octave)Generates the list of pitches that correspond to a chord and an octave.
split_chord_name
(chord_name)Splits a chord name to its root note and the chord quality.