MIDI stands for Musical Instrument Digital Interface, and in layman's terms, is a cool file format developed in the 80s that makes it easy to play music on a computer. The MIDI file format is pretty straightforward, and you can do some cool things if you have a basic grasp of programming and music.
PHP MIDI Class - This is an easy to use PHP class that lets you run a number of operations on a MIDI file. Among the things you can accomplish are manipulate and sequence MIDI data, convert MIDI to text, convert text to MIDI, convert MIDI to Ringtone, you can even convert MIDI files to and from XML.
MIDI File Format - Before you can make full use of the PHP MIDI Class linked above, you'll want to give yourself a primer on the MIDI file format. Each MIDI file contains a header chunk that stores meta information about the file, and a track chunk that contains a series of MIDI events. MIDI events look like a bunch of ons and offs for individual channels, instruments and notes. Each note played has a note number and velocity, as well as a corresponding on and off event. You can get the length of time a note played by comparing the time stamp of the on and off event.
Note - Now that you can read and write MIDI files, you need to convert MIDI note numbers to actual notes on a scale. Middle C is the MIDI note number 60, with C# being 61, and D following as 62. Using that as a starting point you can extrapolate the numbers for other notes. Example F on the first row of the treble clef is 65.
Lassus - A musical note font will let you easily output information as real sheet music. Lassus is a nice music font, but be aware that it is not open source, and not free for commercial use. There are many other music note fonts on the Internet. If a font is not desirable it is possible to use an image based solution. Using a font solution offers more flexibility versus static images that are not easily highlighted and copied with a mouse.
@FONT-FACE GENERATOR - It's easy to display any music note font you find on the web. Font Squirrel's font face generator will produce all of the necessary files and CSS code for you to embed the music note output right onto a webpage.
There you have it, all the toys you need to strip down, manipulate, create, or display MIDI files. If you make anything cool be sure to leave a comment!