Package: chorder-py
chorder-py 0.1.2Fork of chorder with drum fixes.Installationchorder-pyis a chord detection and reharmonize tool for.midfiles. You can downloadchorder-pyusing pip:pipinstallchorder-pyTo check ifchorder-pyis 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.bass(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 11DeChorderDeChorderis 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 strings