A simple, easy to use algorithmic composition MIDI creator for Python, based on midiutil.

Creating a MIDI file can be as simple as this:

from EasyMIDI import EasyMIDI,Track,Note,Chord,RomanChord
from random import choice

easyMIDI = EasyMIDI()
track1 = Track("acoustic grand pino")  # oops

c = Note('C', octave = 5, duration = 1/4, volume = 100)
e = Note('E', 5)
g = Note('G', 5)
chord = Chord([c,e,g])  # a chord of notes C, E and G
track1.addNotes([c, e, g, chord])

# roman numeral chord, first inversion (defaults to key of C)
track1.addNotes(RomanChord('I*', octave = 5, duration = 1))



EasyMIDI.EasyMIDI() EasyMIDI handles MIDI files with the help of midiutil.
EasyMIDI.MusicTheory() MusicTheory contains some helpful music theory data, like the major and minor scales based on the circle of fifths.
EasyMIDI.Track(instrument[, tempo]) Simple Track class which keeps the list of Notes/Chords, the instrument and the tempo.
EasyMIDI.Note(name[, octave, duration, volume]) The Note class contains musical notes and their properties, like octave, duration and volume.
EasyMIDI.Chord([noteList]) The Chord is a simple class that contains lists of Notes.
EasyMIDI.RomanChord([numeral, octave, ...]) The RomanChord class supports Roman chord numerals for creating chord progressions in a relatively easy way.