text

midi on your browser ball
midi on your site ball
QT music ball
QT custom instruments ball
music in marathon ball

Embedding QT midithe server sidea friendly tip

Embedding midi files on your web pages is fairly straightforward, as long as you give some consideration to the various browsers and their approach to midi files. The standard approach is to use the <EMBED SRC> command which will allow you to specify whether the track starts automatically, whether it loops, whether the visitor will have a contol panel and what size that control panel should be eg:

<EMBED SRC="monsters_ate_my_granny.mid" WIDTH=150 HEIGHT=40 PANEL=0 AUTOSTART=TRUE REPEAT=TRUE>

This will work with midi-plug-ins, giving a control panel 150x40 pixels in size. Various sizes will give different looking control panels - check the documentation that comes with the midi plug-in you prefer, or experiment - but remember that not everyone will be using the same plug-in.

MS Internet Explorer can handle midi files without using a midi plug-in, but it does this using <BGSOUND SRC> with an internal midi driver instead eg:

<BGSOUND SRC="monsters_ate_my_granny.mid" AUTOSTART=ON LOOP=INFINITE>

Midi plug-ins won't see this, so the usual solution is to include both instructions in the same page, and let the browser sort it out.

embedding QT midi

Of course, if you've been reading about Quicktime you'll have decided to cut out all this complication by using the embed tag with a movie instead. That way you can guarantee that everyone hears the same thing, that they have the same controller on their page and that it looks the way you designed it.

In that case you use the embed tag as before, but specify:
<EMBED SRC="monsters_ate_my_granny.mov"> having previously exported your midi file through MoviePlayer as a movie. That way you also get round the problems associated with QuickTime on Windows 98 and Explorer which, co-incidentally, started round about the same time as Apple refused to stop developing multimedia playback for the PC. Bill Gates anti-competitive? Nah!

the server side

Help! I hear you cry. The HTML code works fine when you test your pages from your hard drive, but when you upload the site to your web server, the music will play in Explorer (using Explorer's internal midi driver), but not Navigator.

The reason is that your web server needs to be configured to recognise MIDI file types, so that it understands the instructions Navigator sends. Ask your ISP to include the following:

MIME type = audio/midi, audio/x-midi or application/x-midi
action = binary
suffix = .mid
type = midi

I have heard that you can also embed the MIME types in your own web page although I haven't had the chance to test it, having already pestered my own ISP to include these in their server configuration ;)

a friendly tip

There are a plenty of people out there who get plenty irritated when they visit a home page and have to sit waiting while the browser wrestles with a long, complex midi file which loads automatically and which has no controller. Unless you have good reason for doing otherwise, please consider leaving autostart set to 'false' and give the visitor a controller to start and stop the music. If you really want automatic background music, use a simple and short track which loops.

Remember, many midi files start off in studios with dedicated synthesisers, multiple tracks and loads of instruments which most computers can't reproduce anyway. Don't be surprised if you get a midi file of your favourite concerto for your web page, only to find it takes ages to process and sounds nothing like the London Philharmonic anyway. Less is more.

text