Python Midi Package: writing events non-chronologically

tim tim.vets at
Thu Nov 24 12:39:55 CET 2005

Someone using Python Midi Package from lately?

I want to do the following :
write some note events in a midi file
then after doing that, put some controllers at the beginning of the 
(because I want to be able to make those dependant on what notes were 
just written)

def midctrls():
    global roffset, melchan, roffset, gmt, timedisplay, out_file, midi, 
usednotes, n
    midi.reset_time()      #seems to do nothing
    for cha in range(16):
        if cha==1:
            midi.abs_time=0   #seems to do nothing
            midi._relative_time = 0   #seems to do nothing, but I can 
imagine why
            midi._absolute_time = 0   #seems to do nothing
            midi.update_time(new_time=0, relative=0)  #although I give 
the variable relative=0 it seems to be relative ?
            midi.continuous_controller(cha, 0, 122)

With this code I want a controller number 0 with value 122 to be written 
at the beginning of my midifile.
It is written at the end, how I move the writing position to the beginning?

thanks for any help!

More information about the Python-list mailing list