Skip to content

mxm, IT's mad science

Sections
Personal tools
You are here: Home » Products » Open Source » Python Midi Package » solved
Downloads
You can download mxm products here.

Due to it's technical and international nature, this section is in english.

Max M Has a blog too.

og er glad for mad

 

Comment

Above in this comment thread: Python Midi Package » rests

solved

Posted by Anonymous User at 2008-04-18 05:20 AM
aha, i've answered my own question. My problem was that sequential update_time(n) messages override each other, so

midi.note_on(...)
midi.update_time(24)
midi.update_time(47)
midi.update_time(30)
midi.note_off(...)

would be the same as

midi.note_on(...)
midi.update_time(30)
midi.note_off(...).

Since my program requires sequential update_time(n)s, I need to use "blank" midi messages that interrupt update_time. Therefore I could not only use rel_time() or something to that effect, as it does not actually hold a place in the midi file and ergo does not interrupt the count. I used note_off(...) when there was no note playing, which serves the purpose of the "blank" function:

...
if int(beat[2]):
midi.note_on(channel=0, note=0x40)
midi.update_time(24)
midi.note_off(channel=0, note=0x40)
midi.update_time(0)
else:
midi.note_off(channel=0, note=0x40)
midi.update_time(24)
...

Simple enough, I guess.

Thanks a lot, max, this is an amazing module. will come in handy many times