ftp.nice.ch/pub/next/unix/music/NewMidiDrv.README

This is the README for NewMidiDrv.s.tar.gz [Download] [Browse] [Up]

This directory contains an update to the sample source code provided in NeXTstep 2.1 extended OS in the directory /NextDeveloper/Examples/MidiDriver.

The program sources have been cleaned up to fix several bugs and typographical errors.  Also, the parsing of Level 0 MIDI files has been completed to support sequences from various sources including CompuServe and Passport.  Previously, the code only supported Note events and only a single Tempo change.  You should now be better able to use this MIDI code in your own programs as I have removed or at least pointed out many of the bugs.

Bugs fixed:

1. recordmidifile did not actually create a standard single track Level 0 MIDI file.  It generated two tracks, one with tempo and the second with the MIDI data, which is not legal according to the specification from the MIDI Manufacturer's Association (MMA).  I've retained support for playback of these files in playmidifile, but they are now created by recordmidifile according to spec.

2. playmidifile was case sensitive when looking on the command line for a serial port specification.  Even though the usage message showed upper case, the parser checked for lower case.  Now, both are accepted and the usage shows lower case.

3. playmidifile included timer code which was never enabled.  I added a line which starts the timer code by requesting the first event.  To enable this addition, add the following define in the compile line for playmidifile: -DTIMERDISPLAY

4. recordmidifile included timer code which was incorrectly enabled.  The timer request came before the timer start, which resulted in my finding an interesting behavior of the timer: If you request an relative time event before the timer has been started, you will receive a message on the port, but it will not be at the right time (usually the message occurs at quanta 1 or 2, regardless of what time was requested).

5. playmidifile was coded to accept only one Tempo change, whether it came from the command line or the file.  As soon as the global `tempo' was set, no more Tempo changes were accepted.  Now all of the tempo changes in the file are honored.  I have retained the ability to override all Tempo messages in the file when a tempo is specified on the command line.  This revealed bugs in midifile.c which were also fixed.

6. midifile.c did not calculate the size of MIDI events, it merely used 3 as a guess.  Therefore, playback of any MIDI file containing 2 byte MIDI messages was broken - e.g. files including Patch Select or Mono Aftertouch messages.

7. midifile.c had several places where tempo and time scaling factors were incorrectly computed.  I think I killed them all...

8. midifile.c did not parse system exclusive messages in the MIDI file.  They are still not sent to the MIDI Driver, but at least playmidifile will not blow up if it sees these messages.

9. midifile.c treated MIDI files which were SMPTE format as if they were metrical-time format.  SMPTE files are still not supported, but at least playmidifile will no longer attempt to interpret them incorrectly.

Bugs not fixed are marked in the source with // NOTE:

Enjoy,

Brian Willoughby

P.S.  Please send me any bug reports with as much info as possible (the Midi file would really help a lot).  My email address is brianw@microsoft, although my work on the NeXT is not connected with my work at Microsoft.

Original text:
-------------------------------------------------------------------

This directory contains two example programs to read and write data
between the MIDI driver and standard Level 0 midifile.  The
Midifile format is specified by the MIDI Manufacturer's Association,
and is a machine independant format allowing the interchange of 
MIDI (Musical Instrument Digital Interface) sequence data.

The program playmidifile reads a standard Level 0 midifile 
and plays it out through the MIDI driver.  This program 
illustrates both how to parse a  midifile and how to use the
MIDI driver in a simple application.
 
The program recordmidifile read MIDI data from the MIDI driver
and writes directly to a file in the standard Level 0 midifile
format.  This simple commandline utility records MIDI data until
control-c is typed, which then causes the collected data to
be written to a file.  

For both utilities, the user must supply a file name argument, and can give 
an argument to specify which serial port to accept data on.

There are a couple of test midifiles supplied to serve as simple
examples;  they of course require a MIDI synthesizer to play them 
on.  Some attempt was made to provide "machine independant music',
so they should make some reasonable music on any synthesizer, but
experiment around with different voices to achieve the best effect.

Also necessary, of course, is a MIDI interface.  Any standard Apple
MIDI interface will work with the NeXT Computer.


These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.