Skip to main content

A python package for midi clip.

Project description

midi-clip

PyPI

A python package for midi clip (and midi duration) based on mido. (github)

Author: Hyun Shin (kyaryunha)

Introduce

This library considers a lot of things for detailing midi clips: followings:

  • Supports both multi-track MIDI
  • Supports both tempo track & non-tempo track
  • Consider set_tempo, time_signature, controllers that appear before start time or note_on that were not closed
  • Consider empty space before the midi
  • All note_on and note_off pairs are validate. (Number of note_on and note_off is the same, and all note_on are closed by note_off)
  • ...

Usage

pip install midi-clip
import mido
import midi_clip
# load midi use mido
mid = mido.MidiFile('resources/hosu.mid')
# clip midi
output_mid = midi_clip.midi_clip(mid, 5., 15.)
# you can get total duration(second) of midi
duration = midi_clip.midi_duration(output_mid)
# if you see by print
print(output_mid, duration)
# if you save midi clip
output_mid.save('output.mid')

Result

Result of clip "A Town With An Ocean View" MIDI from 0 to 30 seconds and from 5 to 15 seconds.

0s-30s 5s-15s
Piano Roll
Audio https://github.com/kyaryunha/midi-clip/blob/main/example/ocean_0_30.wav https://github.com/kyaryunha/midi-clip/blob/main/example/ocean_5_15.wav

** Used GarageBand to obtain piano roll images and Cubase to obtain audio. GarageBand and Cubase fill in the measure regardless of the actual end of track time in the MIDI, resulting in slightly longer audio. MIDI file's time clip is precisely.

** Data used for result was allowed by an anonymous artist.

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

midi-clip-0.10.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

midi_clip-0.10-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file midi-clip-0.10.tar.gz.

File metadata

  • Download URL: midi-clip-0.10.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for midi-clip-0.10.tar.gz
Algorithm Hash digest
SHA256 6c6b7aa10c5fd9d7462ee9d0dd03980636c99e89f8dc3e91bf66fb8580259512
MD5 36fb48e0570015acfc45ad92d8dc4740
BLAKE2b-256 50cb05310d01d32877bf505efdead6c60174d7457520d4fe2d0a88bd50e4d42f

See more details on using hashes here.

File details

Details for the file midi_clip-0.10-py3-none-any.whl.

File metadata

  • Download URL: midi_clip-0.10-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for midi_clip-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 30816dcdf684d36be9be9029fe7eb7bfd8c760ce2967654daf842946cc23ee71
MD5 f4d25b6420dd78730452348aaa5bd30b
BLAKE2b-256 fb9bdb91abe13585917630eed6587991e78fc3143e00a9283796087523574c09

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