O'Reilly logo

Designing Web Audio & CD-ROM by Dylan Thede, Josh Beggs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 MIDI ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required