Midi Insights: midi analyzer
Project description
MIDI Insights
This package inherits MidiFile of mido, adding note duration quantization functionality MidiFile.quantization and improving the MidiFile.print_tracks method.
import midii
mid = midii.MidiFile(
midii.sample.dataset[1], # or 'song.mid'
convert_1_to_0=True, lyric_encoding="utf-8"
)
mid.quantization(unit="32")
mid.print_tracks(
track_bound=None,
track_list=None,
blind_note_info=True,
blind_lyric=True,
)
Installation
pip install midii
API
-
class midii.MidiFile(filename=None, file=None, type=1, ticks_per_beat=480, charset='latin1', debug=False, clip=False, tracks=None, convert_1_to_0=False, lyric_encoding='utf-8')The parameters of this class are no different from those of the
mido.MidiFileclass it inherits, except forconvert_1_to_0=Falseandlyric_encoding='utf-8'.If you want to convert midi file type
1to0, passconvert_1_to_0=True.lyric_encodingspecify encoding of lyric data.-
quantization(unit="32"): Quantize note duration. You can define least unit of quantization from"1"(whole note),"2"(half note),"4"(quarter note),"8"(eighth note),"16"(sixteenth note),"32"(thirty-second note),"64"(sixty-fourth note),"128"(hundred twenty-eighth note),"256"(two hundred fifty-sixth note)The smaller the minimum unit, the less sync error with the original, and the weaker the quantization effect. As the minimum unit becomes larger, the sync error with the original increases and the quantization effect increases.
-
print_tracks(track_bound=None, blind_note=False, blind_time=False, blind_lyric=True, track_list=None, blind_note_info=False): An overriding function that improves the existingmido.print_tracks.By default it will print all lines of track. By setting like
track_bound=20, You can define upper bound of lines to be printed.By default it will prints all tracks. You can specify the tracks you want to output in the list
track_list. For example,track_list=[], ortrack_list=["piano", "intro"].
-
Example
print_tracks
-
print_tracks:mido.MidiFile.print_tracks→midii.MidiFile.print_tracks
quantization
-
quantization(unit="32"):
License
MIT
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file midii-0.1.5.tar.gz.
File metadata
- Download URL: midii-0.1.5.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdd033d62662212bc1b4b99e9ffec6d38c5295b5d56ca2ea869f1cb156c8672c
|
|
| MD5 |
ba1dd63b1c67fe460c16f01e295facf7
|
|
| BLAKE2b-256 |
0a52d71cba981700356312bf0ac49fdea81c3e96ce498d0df95b2aea02067f2f
|
File details
Details for the file midii-0.1.5-py3-none-any.whl.
File metadata
- Download URL: midii-0.1.5-py3-none-any.whl
- Upload date:
- Size: 33.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0e86ad6ff7f8e691adc6bfb69e8b1fbc87f6850213719b0dfdad971ba5c566c
|
|
| MD5 |
97c0bc3d9f9640215963894eb0c7182f
|
|
| BLAKE2b-256 |
31f44df734c5eaf1b6f50ed9892073f03fc80cb8f74ae2231f89a14a82d569be
|