groover 0.2.2
Installation
groover is a beat-by-beat rhythm feature clustering and token generation tool for .mid files. You can download groover using pip:
pip install groover
To check if groover is successfully installed, type python in the terminal, and do the following:
>>> from groover import RhythmClassifier
>>> type(RhythmClassifier())
<class 'groover.classifier.RhythmClassifier'>
RhythmClassifier
RhythmClassifier.__init__
Returns: None
Parameters (all optional)
bins_per_beat:int- the number of quantized time units within a beat
- is set to 24 by default
n_beats_pitched:int- the number of beats that consist a rhythmic pattern for pitched instruments
- is set to 1 by default
n_beats_drums:int- the number of beats that consist a rhythmic pattern for drum instruments
- is set to 4 by default
drums:list- a list of
strthat specifies which types of drums to consider - complete mapping from drum names to MIDI pitches can be found in
groover.drum_names_to_pitches
- a list of
notes_weight: callable- a function that takes a list of
miditoolkit.midi.containers.Noteas input, and outputs annumpy.ndarraywith shape(len(notes),)
- a function that takes a list of
similarity: callable- a function that takes two
numpy.ndarrayand output the similarity score between the two arrays
- a function that takes two
RhythmClassifier.get_pitched_dataset(self, midi_objs, pitches=None, in_four=False)
Returns: numpy.ndarray
- a dataset that contains rhythmic patterns extracted from pitched instruments of the MIDI objects
- has shape
(n, m), wherenis the number of patterns andmis the number of quantized time units within a pattern
Parameters
midi_objs:list- a list of
miditoolkit.midi.parser.MidiFileto extract rhythmic patterns from
- a list of
pitches: iterable- an iterable that contains the pitches to be considered
- is set to
range(128)by default
in_four:bool- will only consider MIDI files that has time signatures in power of two if set to
True
- will only consider MIDI files that has time signatures in power of two if set to
RhythmClassifier.get_drum_dataset(self, midi_objs, in_four=False)
Returns: numpy.ndarray
- a dataset that contains rhythmic patterns extracted from drum instruments of the MIDI objects
- has shape
(n, len(self.drums), m), wherenis the number of patterns andmis the number of quantized time units within a pattern
Parameters
midi_objs:list- a list of
miditoolkit.midi.parser.MidiFileto extract rhythmic patterns from
- a list of
in_four:bool- will only consider MIDI files that has time signatures in power of two if set to
True
- will only consider MIDI files that has time signatures in power of two if set to
RhythmClassifier.def fit_from_midi(self, midi_objs, k_pitched=200, k_all_drums=100, k_single_drum=20, quantize=True):
Returns: None
The RhythmClassifier instance itself will be modified with updated rhythmic pattern clusters.
Parameters
midi_objs:list- a list of
miditoolkit.midi.parser.MidiFileto classify rhythmic patterns from
- a list of
k_pitched:int- the number of rhythmic pattern classes from pitched instruments
k_all_drums:int- the number of rhythmic pattern classes from drum instruments
k_single_drum:int- the number of rhythmic pattern classes from each drum
quantize:bool- quantize drum patterns further down to 16th notes if set to
True
- quantize drum patterns further down to 16th notes if set to
RhythmClassifier.add_pitched_markers(self, midi_obj, pitches=None)
Returns: None
midi_obj will be modified with rhythmic pattern markers from pitched instruments in midi_obj.markers
Parameters
midi_obj:miditoolkit.midi.parser.MidiFile- the MIDI file to add rhythmic pattern markers from pitched instruments to
pitches: iterable- an iterable that contains the pitches to be considered
- is set to
range(128)by default
RhythmClassifier.add_composite_drum_markers(self, midi_obj, rid_empty=True)
Returns: None
midi_obj will be modified with rhythmic pattern markers from drum instruments in midi_obj.markers
Parameters
midi_obj:miditoolkit.midi.parser.MidiFile- the MIDI file to add rhythmic pattern markers from drum instruments to
rid_empty:bool- sections with no drums will not add markers to the MIDI files if set to
True
- sections with no drums will not add markers to the MIDI files if set to
RhythmClassifier.add_separate_drum_markers(self, midi_obj, rid_empty=True)
Returns: None
midi_obj will be modified with rhythmic pattern markers from each drum instruments in midi_obj.markers
Parameters
midi_obj:miditoolkit.midi.parser.MidiFile- the MIDI file to add rhythmic pattern markers from each drum instruments to
rid_empty:bool- sections with no drums will not add markers to the MIDI files if set to
True
- sections with no drums will not add markers to the MIDI files if set to
Metadata
Release files for groover 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| groover-0.2.2.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| groover-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / groover-0.2.2.tar.gz
| Download URL | groover-0.2.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e5e03a6ef706124e296da1b36be54dff93a2706191a0629b4eec661be194420
|
|
BLAKE2b-256 checksum How to use checksums |
8db2bc081e9b97e626b128ba42a1ccbff9a37c080ee9f8cb1e1341dc7b1dc6c9
|
| 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 / groover-0.2.2-py3-none-any.whl
| Download URL | groover-0.2.2-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d5135d7b74f4afed6bae0108c3cee4a8830c44f3e74e4b4b1f23b3e4406c387
|
|
BLAKE2b-256 checksum How to use checksums |
edf59d6f8a4f02d8f483498f51ad36d9bd0b3780a8cebbdef058e6ae0240bdec
|
| 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
|