Iomidi
Python library for MIDI input and output
Install / Use
/learn @erdiaker/IomidiREADME
iomidi
Python library for basic MIDI input and output.
Installation
You can install via PyPI by typing the following in your terminal:
pip install iomidi
Examples
Creating a MIDI file
import iomidi
# A MIDI file consists of one or more MIDI tracks.
# Create an empty track.
track = iomidi.MIDITrack()
# A MIDI track is a series of one or more events.
# Create some events.
pressC = iomidi.NoteOnEvent(
delta=100, # time to wait after the previous event in terms of ticks
channel=0, # midi channel
key=60, # midi note, 60 is middle C
velocity=100) # pressure of the key press
releaseC = iomidi.NoteOffEvent(
delta=1100,
channel=0,
key=60,
velocity=0)
# Add these events to the track.
track.addEvent(pressC)
track.addEvent(releaseC)
# Add a meta event to denote the end of track
endOfTrack = iomidi.EndOfTrackEvent(delta=1)
track.addEvent(endOfTrack)
# Create a MIDI structure, put the track in it.
midi = iomidi.MIDI(tracks=[track])
# Write the midi structure into a file.
iomidi.write('simple.mid', midi)
Loading a MIDI file
import iomidi
midi = iomidi.read('simple.mid')
print(midi)
License
MIT
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
109.5kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
349.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
