Package: chorder
chorder 0.1.4Installationchorderis a chord detection and reharmonize tool for.midfiles. You can downloadchorderusing pip:pipinstallchorderTo check ifchorderis successfully installed, typepythonin the terminal, and do the following:>>>fromchorderimportChord>>>Chord()Chord(root_pc=None,quality=None,bass_pc=None)DocumentationChordTheChordclass is the basic building block for the whole chorder package. AChordinstance has four attributes, including:root_pcthe pitch class of a chord's root noteis an integer ranging from 0 to 11quality, the quality of a chord (the complete list of quality)the quality of a chordis a stringthe complete list of qualities covered inchordercan be found atChord.standard_qualitiesbass_pcthe pitch class of a chord's bass noteis an integer ranging from 0 to 11scalethe scale of the chordis a list of strings representing the note names of each pitch class from 0 to 11if a scale is not specified, a default scale is used, which is inChord.default_scaleChord.__init__(self, args=None, scale=None)Parametersargs:Noneorstrortuple, optionalNone: implies constructing an empty chordstr: a chord symbol, such as'Bbmaj7'tuple: a tuple consisting of `(root_pc, quality, bass_pc)scale:list, optionalspecify the scale the chord useswill useChord.default_scaleif left asNoneChord.root(self)Returns the root note name of a chord based on the chord's scale.Chord.bass(self)Returns the bass note name of a chord based on the chord's scale.Chord.is_complete(self)Returns if any attributes of a chord isNone. This can help filtering empty chords.Chord.transpose(self, key)Transposes a chord to C-based relative chord. For example,Chord('Bb7').transpose(3)should returnChord('G7').Parameterskey:intthe pitch class of the keyranges from 0 to 11Chord.simple_text(self)Returns a chord's root and quality, with an underscore in between. For example, C_M.Chord.simplify(self)Returns a new chord which reduces a seventh chord to a triad.DeChorderDeChorderis a class that consists of static methods related to chord recognition. To utilize this class, the midi information has to be in the form ofmiditoolkitobjects.Dechorder.get_bass_pc(notes, start=0, end=1e7)Returns the pitch class of bass note among the notes between the time range ofstartandend.Parametersnotes: listthe group of notesnotes are in the form ofmiditoolkit.midi.containers.Notestart: intthe start tick of the notes to be consideredset it tonotes[0].startfor now, as this feature will later be updatedend: intthe end tick of the notes to be consideredset it tonotes[-1].endfor now, as this feature will later be updatedDechorder.get_chord_quality(notes, start=0, end=1e7, consider_bass=False)Returns the chord among the notes between the time range ofstartandend.Parametersnotes: listthe group of notesnotes are in the form ofmiditoolkit.midi.containers.Notestart: intthe start tick of the notes to be consideredset it tonotes[0].startfor now, as this feature will later be updatedend: intthe end tick of the notes to be consideredset it tonotes[-1].endfor now, as this feature will later be updatedconsider_bass: `booldecreases the likelihood of chords with non-chord tones as bass to be chosen as the answerDechorder.dechord(midi_obj, scale=None)Returns a list of chords by beat.Parametersmidi_obj:miditoolkit.midi.parser.MidiFilethe midi object to extract chord symbols fromscale:listthe list of note names for each pitch classmust be a list of stringsSchorerSchoreris a class that consists of static methods related to chord-alignment metrics. To utilize this class, the midi information has to be in the form ofmiditoolkitobjects.Schorer.get_regional_chord_score(notes, chord, start=0, end=1e7)Returns the group of notes' alignment score with the chord as a float.Parametersnotes: listthe group of notesnotes are in the form ofmiditoolkit.midi.containers.Notechord:chorder.Chordthe chord whose alignment with the notes will be testedstart: intthe start tick of the notes to be consideredset it tonotes[0].startfor now, as this feature will later be updatedend: intthe end tick of the notes to be consideredset it tonotes[-1].endfor now, as this feature will later be updatedSchorer.get_chord_scores(midi_obj, split_char='_')Returns a tuple of two elements: the list of chords in the midi object's markers, and the numpy array of alignment scoresParametersmidi_obj:miditoolkit.midi.parser.MidiFilethe midi object to evaluate onsplit_char: strThe splitting string in chord marker text. For example, if the markers' text come in the form ofA_m7, thensplit_charis'_'.