A python package for working with MIDI data files. (POZAlabs forked)
Project description
Miditoolkit
A Python package for working with MIDI files.
Miditoolkit works by loading/writing MIDIs with mido in a user-friendly way. It is inspired from pretty_midi, with similar usage and core features, but handles the MIDI events in native ticks time unit instead of seconds. It also comes with a few optimizations and speed-ups, and can parse MIDI tracks into piano-rolls for computation or visualization purposes. If you are working with seconds time units (for e.g. music transcription), you'll be likely better with pretty_midi. Otherwise, if you are working solely on MIDI and symbolic music, miditoolkit should provide slightly faster performances.
Main Features
- MIDI
- Global
- ticks per beat
- tempo changes
- key signatures
- time signatures
- lyrics
- markers
- Instruments
- control changes
- pitch bend
- Editing
- chunk/cropping
- IO
- BytesIO
- Global
- Piano-rolls
- Tools
- notes to piano-rolls
- piano-rolls to notes
- chromagram
- Visualization
- Tools
- External Library
TODO
- better documentation;
- finish the code cleaning of the pianoroll methods (vis);
- a way to switch the time in seconds across the whole MidiFile object;
- cropping Control Changes and bars;
- symbolic features
- new structural analysis
Installation
You can install miditoolkit via PYPI:
pip install miditoolkit
... or directly from git if you want to get the latest features or fixes (only recommended if you need it):
pip install git+https://github.com/YatingMusic/miditoolkit
Example Usage
from miditoolkit import MidiFile
from miditoolkit.midi.utils import example_midi_file
path_midi = example_midi_file()
midi_obj = MidiFile(path_midi)
print(midi_obj)
Output:
ticks per beat: 480
max tick: 72002
tempo changes: 68
time sig: 2
key sig: 0
markers: 71
lyrics: False
instruments: 2
A. Parse and create MIDI files B. Piano-roll Manipulation
Philosophy
- mido processes MIDI files in the lower level such as messages and ports, and is the backend pretty_midi and miditoolkit;
- pretty_midi parses MIDI files and pianorolls in seconds time unit, plus has audio related features;
- pypianoroll parses MIDI files into pianorolls in ticks time unit.
Miditoolkit is designed for handling MIDI in ticks, the native time unit of the MIDI protocol. We keep the midi parser as simple as possible, and offer several important functions to complete the versatility. For example, piano-rolls, tick-to-second, chromagram, etc.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pozalabs-miditoolkit-1.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 980e7736a0415a3d6229fe34c7f8965659b6682c92fa98b1e6b78ca9dc10abb7 |
|
MD5 | 790e0887b2c8bdf811049adc2d96390b |
|
BLAKE2b-256 | a91d4bc83373937847a85fca294b318bb71b9688008effe741981f4f3b29b287 |
Hashes for pozalabs_miditoolkit-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31be61e8b76ccf4e2d484b386349a71f904981bd24b035ca29cc69d93409d64a |
|
MD5 | e7528d64ca4deb7f229ee488d88facb7 |
|
BLAKE2b-256 | 330c3d3018a6e7215ba8d4bdb7d13e12b023c23aa31868f4e3abf3229192b33a |