Musical Instrument Digital
Interface. It is both a way of connecting to digital musical intruments and a way
compactly recording music for playback by digital musical istruments or a software sythesiser in a computer.
MIDI came out in 1991. An augmented, upward compatible MIDI-2 came out in 1999.
DLS (Down loadable Sounds)
enables sampling, making sounds with a wavetable sound capture rather than mathematicallly. XMF (eXtensible
Music Format) combines MIDI and DLS in one file.
The MIDI stream sent to instruments over the 5-pin DIN serial connection contains no embedded timing information. The
notes are sent the instant they are intended to be played. MIDI files on the other hand need embedded timing information
to track when to send the commands.
Trying Out Midi
So long as your browser has a midi player installed, just clicking on that link will cause it to play. Try it here:
Bach |
Jesu Joy of Man’s Desiring |
Maple Leaf Rag |
Ain’t Misbehavin |
Ain’t we Got Fun |
The living Love catalyst |
The Bodyguard |
I Can see Clearly Now |
The Impossible Dream |
Killing me Softly |
Do the Locomotion |
Puff The Magic Dragon |
Start Me Up |
Take Five |
Wind Beneath My Wings |
The Pearl Fishers |
Advantages and Disadvantage of MIDI
Playing those samples will point out MIDI’s big disadvantage. It can handle only synthesiser intrumentals, no
voice. It can’t do speech or other arbitratry sounds. The big advantage is how quick it is to download compared
with the other formats such as MP3. It is much more compact.
If you are a musician, you can modify MIDI files to use different instruments, and feed them into your digital musical
instruments. You can also modify the music as you please, to change the tempo or even even the notes and durations.
Basically, MIDI just tells your computer to play middle C for 250 milliseconds sounding as best like a piano or a
trumpet as it can. The quality of the sound card hardware and the software synthesiser in the computer playing the MIDI
file has a lot to with how lush and realistic the performance sounds. It will sound totally different played on
different computers. Only the timing and pitch will match.
There are at least 4 flavours of MIDI: MIDI 0, MIDI 1, RIFF MIDI 0, RIFF MIDI 1.
Using MIDI in HTML
To embed a MIDI file on your web page, all you need do is add some HTML like this:
<a href="../sound/bach2.mid">
. You usually want some sort of gif to indicate a playable link. Here is a simple way to embed a midi file and have it
automatically play:
<EMBED SRC="../sound/bach2.mid" HIDDEN="TRUE" AUTOSTART="TRUE" ALIGN=LEFT>
It appears to work with Opera, IE and Netscape.
Using JavaScript, it is also possible to cause a song to start playing automatically as soon as a page is loaded.
Using MIDI in Java 1.1
Java 1.1 does not officially support MIDI music files, but on some browsers this trick will work:
getAppletContext().showDocument ( new URL ( getCodeBase(), "test.mid" ) );
They would need a Midi player installed. The music must exist in a file accessible via URL. You can’t use this
trick to play some music you have sitting in a byte array.
MIDI in Java 1.3+
With JDK 1.3, Java supports MIDI in a massive way. javax.media.sound.midi provides
interfaces and classes for I/O, sequencing, and synthesis of MIDI. javax.media.sound.midi.spi
supplies interfaces for service providers to implement when offering new MIDI devices, MIDI file readers and writers, or
sound bank readers.
Creating MIDI files
Normally you use music software to enter a score and arrange it. Hackers might enjoy reading up on the MIDI file spec
and creating files programmatically with a hex editor. However Digital
Ear : Real-time Audio (.wav ) to MIDI converter ! is a
is real time utility to convert midi to wav format, and astoundingly, wav to midi. That utility does much what a human
would do listening to music and writing down the equivalent notation. The raw result needs touch up, at least to assign
a voice, and requires a monphonic (single voice, no chords or polyphony) source, but it is a way of extracting compact,
malleable midi from ordinary sound sources. If you use your own voice as input, it can correct pitch but preserve
vibrato.