import sys, time, re import music21 import mingus.core.notes as notes import mingus.core.value as value sys.path.append('/usr/local/lib/python2.7/dist-packages/fluidsynth/') from mingus.midi import fluidsynth from mingus.containers.Note import Note from mingus.containers.Bar import Bar fluidsynth.init('/usr/share/sounds/sf2/FluidR3_GM.sf2',"alsa") print len(allnotes) print sum(alldurations) # Put notes into one huge bar. b = Bar() b.set_meter((len(allnotes) * 4, 4)) for note in allnotes: b.place_notes(note, value.eighth) print len(b) fluidsynth.play_Bar(b, 1, 375) # You really should keep rhythm within clusters consistent (either straight eighths or alternating between # long/short to get that 'swung' feel).