Adding MIDI to your web pages

Making MIDI files can be fun and easy; placing them on your web page can be even easier. Simply enter this line of code in your HTML:

<BGSOUND SRC="Yoursound.mid">

Note that this example is for Explorer. If Navigator has trouble with the BGSOUND tag, try the following example in addition to the BGSOUND:

<EMBED SRC="Yoursound.mid" HIDDEN="true">

This code causes a MIDI file to begin playback whenever the page is loaded into the user’s browser. Furthermore, you can set basic parameters such as looping, volume, and so forth, by simply adding them to the tag. Here is the most basic way to add MIDI sound to your web page:

<EMBED SRC="Yoursound.mid" HIDDEN="true"
loop="yes"
volume="10"
autostart="true">

This example HTML code will instruct a web page to play Yoursound.mid. The file will loop, the volume will be at the max limit of 10, the autostart function will be in effect, and the file will begin playback automatically

If you want to have MIDI sound available on your web page via a hyperlink, but do not want the file to begin playback automatically, simply add an HREF tag to the MIDI file, and it will be available for download whenever the user clicks on the link:

<A HREF="Yoursound.mid">

Making a MIDI jukebox

Many web designers have taken advantage of the short download times and cross-platform performance of MIDI and have created a variety of tools and tricks that you can use on your own web pages. One basic example of how to use MIDI on your site is the ...

Get Designing Web Audio & CD-ROM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.