Short: A DICE link library for handling MIDI files Author: ajung@cs.uni-sb (Andreas Jung) Uploader: ajung cs uni-sb (Andreas Jung) Type: mus/midi Version: 1.2 Architecture: m68k-amigaos This directory contains a library of code to read and write standard MIDI files, a standard as defined by the MMA, the MIDI Manufacturer's Assocation. The format spec is available from the IMA: International MIDI Association 5316 West 57th Street Los Angeles, CA 90056 "make mftext" will compile a program that gives a verbose textual listing of a MIDI file, and is an example of how to read a file. "make mf1to0" will compile a program that demonstrates how to write midi files, and converts format 1 multitrack files to format 0. "make midifile.man" will produce a formatted manual page. Example MIDI files are named "example*.uu". They're uuencoded; "make uutomid" will uudecode them all. The first two examples (example1 and example2) are the examples given in the 0.06 version of the standard MIDI file specification. ...Tim Thompson...att!twitch!glimmer!tjt... June, 1989 - Added code to write midi files and the mf1to0 program. Michael Czeiszperger czei@pan.com Notes on Porting: This library was written on UNIX, and tested on Sun's, PC's and Mac's. It is distributed in a raw vanilla state, which means you may have to do a little editing depending on the requirements of your particular development system. For instance, with THINK C on the Mac, you have to be careful and include all the include files needed by their implementation of UNIX calls such as malloc(). I've left in the proper calls ifdef'd on THINK so you'll have a clue what to do. czei@pan.com ------------------------------------------------------------------------------- This code was ported from the orginal sources to Commodore Amiga system by Andreas Jung Klosterstr. 21 D-66125 Saarbruecken, Germany Email: ajung@cs.uni-sb.de The following changes were made: - beautified the sources using indent - removed most of the K&R declarations and replaced them by ANSI declarations - fixed sources to use with DICE Professional This package is distributed "as-is" under the GNU Public License. I used part of the code in my program MIDI PERFORMANCE MANAGER - MPM. It seems to work fine. No bugs were found yet. The code does *NOT* support MIDI format 2 files, only format 0 and 1 is supported ! --------------------------------------------------------------------------------- History: V 1.0 Initial Amiga release V 1.1 Fixed bug in header file V 1.2 Updated archive with the sources of midifile V 1.11: (1) can now set the global variable Mf_interactive to 1 to prevent the reading functions from looking for file and track headers (2) can now write system exclusive data with mf_write_midi_event(delta_time, system_exlusive, 0, data, size) (3) changed definition of 'sequencer_specific' in midifile.h to 0x7f (4) changed mf_write_tempo to take additional delta_time as first argument (since delta need not be zero) (5) added function mf_write_seqnum(unsigned long delta_time, unsigned seqnum) (6) changed mf_write_midi_event to use running status (7) removed the code to write an end of track meta event automatically -- this must now be done by the user of the library (I changed it because I need to be able to control the time delta of this meta event) (8) added global variables Mf_division, Mf_currtempo, Mf_realtime, which are updated by the reading functions. Mf_realtime is useful, because Mf_currtime does not really measure time at all, since its units change value at every tempo change. Mf_realtime is the midi-time elapsed in units of 1/16 of a centisecond (but it does not handle smpte times) (9) maintains a history of tempo settings to update Mf_currtempo, to handle tempo tracks. (10) if there is an Mf_error function, the error routine no longer exits, leaving it to the application to do this. (11) chanmessage skips over invalid c1 command bytes > 127 and adjusts invalid c2 argument byte > 127 to 127. (12) readmt returns EOF when it encounters a 0 or 0x1a byte instead of an expected header string (some midi files have padding at end).