Skip to main content

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.MidiFile class it inherits, except for convert_1_to_0=False and lyric_encoding='utf-8'.

    If you want to convert midi file type 1 to 0, pass convert_1_to_0=True.

    lyric_encoding specify 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 existing mido.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=[], or track_list=["piano", "intro"].

Example

  • print_tracks: mido.MidiFile.print_tracksmidii.MidiFile.print_tracks

  • quantization(unit="32"):

License

MIT

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

midii-0.1.4.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

midii-0.1.4-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file midii-0.1.4.tar.gz.

File metadata

  • Download URL: midii-0.1.4.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.10

File hashes

Hashes for midii-0.1.4.tar.gz
Algorithm Hash digest
SHA256 97dbcdfc49783c85f37d9b4b6dfa1eff52f7630a8ad85065158607140c20f4e2
MD5 f94e7b62468ffaf015b530970075110f
BLAKE2b-256 a0491027f93f264eac1fccf8773ff6fcaf401245318e92f0fa23d3b9b3fc5366

See more details on using hashes here.

File details

Details for the file midii-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: midii-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.10

File hashes

Hashes for midii-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3d9aec2f1c841fcae0f3f99a581152ee33cb5cca310ec8e793e3ff3fcad5e86e
MD5 edca08cfbcd85ae7dfb70b25dd736b5e
BLAKE2b-256 148b9edaa3b0e0cfa1409631744bba0d3552aa2de22c62eb9a228e51c7268150

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page