chorder 0.1.4
Installation
chorder is a chord detection and reharmonize tool for .mid files. You can download chorder using pip:
pip install chorder
To check if chorder is successfully installed, type python in the terminal, and do the following:
>>> from chorder import Chord
>>> Chord()
Chord(root_pc=None, quality=None, bass_pc=None)
Documentation
Chord
The Chord class is the basic building block for the whole chorder package. A Chord instance has four attributes, including:
root_pc- the pitch class of a chord's root note
- is an integer ranging from 0 to 11
quality, the quality of a chord (the complete list of quality)- the quality of a chord
- is a string
- the complete list of qualities covered in
chordercan be found atChord.standard_qualities
bass_pc- the pitch class of a chord's bass note
- is an integer ranging from 0 to 11
scale- the scale of the chord
- is a list of strings representing the note names of each pitch class from 0 to 11
- if a scale is not specified, a default scale is used, which is in
Chord.default_scale
Chord.__init__(self, args=None, scale=None)
Parameters
args: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, optional- specify the scale the chord uses
- will use
Chord.default_scaleif left asNone
Chord.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 is None. 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 return Chord('G7').
Parameters
key:int- the pitch class of the key
- ranges from 0 to 11
Chord.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.
DeChorder
DeChorder is a class that consists of static methods related to chord recognition. To utilize this class, the midi information has to be in the form of miditoolkit objects.
Dechorder.get_bass_pc(notes, start=0, end=1e7)
Returns the pitch class of bass note among the notes between the time range of start and end.
Parameters
notes: list- the group of notes
- notes are in the form of
miditoolkit.midi.containers.Note
start: int- the start tick of the notes to be considered
- set it to
notes[0].startfor now, as this feature will later be updated
end: int- the end tick of the notes to be considered
- set it to
notes[-1].endfor now, as this feature will later be updated
Dechorder.get_chord_quality(notes, start=0, end=1e7, consider_bass=False)
Returns the chord among the notes between the time range of start and end.
Parameters
notes: list- the group of notes
- notes are in the form of
miditoolkit.midi.containers.Note
start: int- the start tick of the notes to be considered
- set it to
notes[0].startfor now, as this feature will later be updated
end: int- the end tick of the notes to be considered
- set it to
notes[-1].endfor now, as this feature will later be updated
consider_bass: `bool- decreases the likelihood of chords with non-chord tones as bass to be chosen as the answer
Dechorder.dechord(midi_obj, scale=None)
Returns a list of chords by beat.
Parameters
midi_obj:miditoolkit.midi.parser.MidiFile- the midi object to extract chord symbols from
scale:list- the list of note names for each pitch class
- must be a list of strings
Schorer
Schorer is 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 of miditoolkit objects.
Schorer.get_regional_chord_score(notes, chord, start=0, end=1e7)
Returns the group of notes' alignment score with the chord as a float.
Parameters
notes: list- the group of notes
- notes are in the form of
miditoolkit.midi.containers.Note
chord:chorder.Chord- the chord whose alignment with the notes will be tested
start: int- the start tick of the notes to be considered
- set it to
notes[0].startfor now, as this feature will later be updated
end: int- the end tick of the notes to be considered
- set it to
notes[-1].endfor now, as this feature will later be updated
Schorer.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 scores
Parameters
midi_obj:miditoolkit.midi.parser.MidiFile- the midi object to evaluate on
split_char: str- The splitting string in chord marker text. For example, if the markers' text come in the form of
A_m7, thensplit_charis'_'.
- The splitting string in chord marker text. For example, if the markers' text come in the form of
Metadata
Release files for chorder 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chorder-0.1.4.tar.gz | 10.8 kB | Without provenance | Details for chorder-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chorder-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for chorder-0.1.4-py3-none-any.whl |
Total release size: 21.3 kB
Release files / chorder-0.1.4.tar.gz
| Download URL | chorder-0.1.4.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27487c1d9bda8fdc3a63eb2c0254ad6e1ac01010643a9c6a0a25f9771a0bee27
|
|
BLAKE2b-256 checksum How to use checksums |
23591127f112416043e62b1bb7d18e2b37e38e1d31a2303974f337a4b3d1ce56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10
|
Release files / chorder-0.1.4-py3-none-any.whl
| Download URL | chorder-0.1.4-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc1d458e9c3aa12baf553079e6cbaf7f9ecead4115b4c3ec602b482e4aed5aca
|
|
BLAKE2b-256 checksum How to use checksums |
c4002936a62b82a97aa647be5f73ab247f8e2addf0262678c078ba1eceb1f092
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10
|
Security for chorder 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.