kroger at pedrokroger
May 9, 2012, 10:14 AM
Post #4 of 10
I don't know the details of how Kontakt works, but you can try pygame.midi:
pygame.midi - is a portmidi wrapper orginally based on the pyportmidi wrapper. Also pygame.music can play midi files. Can get input from midi devices and can output to midi devices. For osx, linux and windows. New with pygame 1.9.0. python -m pygame.examples.midi --output
On May 9, 2012, at 1:33 PM, Toby wrote:
> On 05/09/2012 09:13 AM, Dave Angel wrote:
>> On 05/09/2012 11:52 AM, Tobiah wrote:
>>> I'd like to send MIDI events from python to another
>>> program. I'd like advice as to how to accurately
>>> time the events. I'll have a list of floating point
>>> start times in seconds for the events, and I'd like to send them
>>> off as close to the correct time as possible.
>>> I'd also appreciate suggestions and pointers to a
>>> suitable python MIDI library, and maybe an outline
>>> of what must be done to get the MIDI events to
>>> the other program's MIDI in.
>> You really need to specify the OS environment you're targeting, as well
>> as telling what program you're intending to feed MIDI into, if you've
>> already picked one.
> I'm using Kontakt on Windows 7. The MIDI file think would be good, but
> (not having that computer in front of me) I don't think that Kontakt
> had the ability to open a MIDI file.
> Now, I know that I could load the file into Reaper, and use Kontakt
> as a plugin. My problem is that I can't afford to mess with GUI menus
> during my composition process. I need to edit a python program in
> Vi, then slap it out to python, hearing the music, then edit again.
> The cycle has to be very quick in order to get anything done.
> Loading Kontakt with a bunch of samples is very time consuming, so
> it needs to keep running. Now, if I could find a program that would
> interpret the MIDI file and send events off to Kontakt either as a plugin
> or standalone, then the MIDI file generation idea would be perfect.
>> Also, the midi file format has timing information, and that timing
>> should be much better than trying to do it in python before sending
>> commands to some external program. In other words, instead of sleeping
>> in your code and then issuing one midi event, use the midi file format
>> to send a stream of commands that will be played according to the timing
>> information included.