Package com.palserv.XMidi

The XMidi package converts between midi and XMidi files.

See:
          Description

Interface Summary
Parser This is the interface to implement when you want to include an XML parser.
 

Class Summary
ByteLen internal class
CmdLineArgs internal class
JAXP This is the helper class for the Sun JAXP parser.
MX Convert a midi file to an XMidi (XML) file.
Util internal utilities
Version This class does nothing but provide the "global" version number.
Xerces This class allows the Xerces XML parser to be used with the XMidi package.
XM Convert an XMidi file (XML) to a midi file.
XSilfide This class allows the silfide XML parser to be used with the XMidi package.
 

Package com.palserv.XMidi Description

The XMidi package converts between midi and XMidi files. Along with the XMidi DTD file (XMidi.dtd), it defines the XMidi format. In brief, the MX class allows for conversion from a midi file to an XMidi file (XML), while the XM class goes the other way (XMidi to midi). The command line format is included in the doc for these classes.

Both MX and XM require the presence of an XML parser. I supply one, silfide.jar, to go with the XSilfide token (see below) and class. There are numerous other parsers of excellent quality available. The nature of MX and XM is such that the name of a helper class can be passed on the command line (or directly, through the constructor) as an option. Thus, no code changes to this package are required to include a new parser.

The following table identifies parser_id tokens of helper classes which are included with this package. The Token must be spelled just as it appears, including upper and lower case. These tokens are possible arguments for the -p command line option. If you add a new helper class, you can code the complete (fully qualified) name in the -p option and also code the -q option. If you don't code the -q option, the program assumes that the class named in the -p option is in the com.palserv.XMidi (this) package. Details of the command line options can be found in the Util.getCmdLine method.

The URL is where you can get the freeware.
Token URL Validating Comments
XSilfide http://www.loria.fr/projets/XSilfide/EN/sxp/ yes This is the default if you leave out the "-p" option. It can be used as a model for this kind of class.
Xerces http://www.alphaworks.ibm.com/tech/xml yes This is from the collaboration of IBM and Apache.
JAXP http://java.sun.com yes This is from Sun. Need I say more?
To be used by this package, there must exist (in the classpath) a "helper class" which implements com.palserv.XMidi.Parser. It must be able to communicate with the parser and return a com.w3c.dom.Document object, either of a parsed XML file or a new (empty) object.

If you want to use a parser which is not on the list (the above table), write a class with these features:

To invoke the external parser, use the class name as the parser_id of the -p option. A good model for this is the XSilfide class

The XML file produced by MX and read by XM is validated by the XMidi DTD, XMidi.dtd, which is included in the zip file.

My thanks to the author of the http://www.borg.com/~jglatt/ web site. The information there concerning the midi file format, and midi data in general was of great assistance to me, particularly in the MX class (which reads a midi file) and the XM class (which writes a midi file).

Testing has been minimal, so far. I used seven midi files from various sources. For each midi file, I used MX to convert it to XMidi, then used XM to convert the resulting XMidi file to a new midi file (in a different subdirectory). When the files compared equal, byte for byte, I concluded that at least parts of these programs work some of the time.

I am certain, however, that bugs persist. I just haven't found them, yet.

Each piece of source code contains a copy of the MIT Licence. My intent is that this be "open source" software. See OSI for a description of what that means.

The most up-to-date version of all files pertaining to this project can always be found at http://www.palserv.com/XMidi/ and correspondence should be addressed to peter@palserv.com

Author:
Peter Arthur Loeb