Real Time Midi File Playback - Reading and Writing midi at the same time

Ken Starks straton at lampsacos.demon.co.uk
Sun May 4 17:16:50 EDT 2008


Gilly wrote:
> Hi
> I am trying to create an application that uses some form of input to
> create a midi file.
> I would like for this to be a 'real time' process. In other words, I
> want to be able to begin playing the midi file before I finish writing
> it, and continue writing as it plays.
> 
> I would really appreciate any help possible on this matter.
> 
> Thanks!!
Not python, but have you come across XMidi (http://www.palserv.com/XMidi/) ?

It is used in the Apache Cocoon project, which has a
Midi 'block'.
This allows you to go from an XML file, or other
source, to XMidi (an XML version of MIDI), and then
to Quicktime, which you can listen to in your browser.

I'm afraid I don't know whether the source can be
streaming XML or whether you have to reach the end
of the XML before it starts to play.

If you can use streaming XML, you should be able to
generate it from python. Foursuite has a streaming
XML class, for example.

********************************************

A quick synopsis on the cocoon site says:

What is the MIDI block?

The MIDI block currently gives you an XMidiGenerator to generate an XML 
representation of any MIDI file (called XMidi by its author Peter Loeb). 
There is also the XMidiSerializer to render XMidi back as a MIDI file. I 
have used XSLT to provide some basic musical manipulations such as 
transposition, and inversion. Retrograde is harder, but I shall see what 
I can come up with. Hopefully I shall also add some transformers to 
generate SVG visualisations of the XMidi, starting with normal western 
musical notation.



More information about the Python-list mailing list