The Sound of Music
By Lisa Hui
The web is not only a visual medium; it has the ability to blend multimedia to achieve an effect of near-great proportions. Part of this may be due to the ability to trigger sound effects upon clicking a button or to add music to the page or web site. It may simply enhance your interactive experience. If you want to hear the web, turn on your speakers. If you want to be a part of the multimedia movement, read this tutorial :)
Perhaps getting a little background information on how sound works on your computer might make it easier to grasp the concept of streaming and various file types [sound files are commonly seen/heard or distributed on the web as MIDI (*.mid), WAV (*.wav), RealAudio (*.ra) or MP3s (*.mp3)] The two types of "computer sound" are called sampled and synthesized.
Synthesized sounds are probably one of the most popularly used formats, in particular, MIDI, which stands for Musical Instrument Digital Interface. A MIDI can simulate playing up to 16 different "instruments" at once! But the major advantage of MIDI files over their qualitative superior, the WAV, (well come to think of it, most audio formats have better sound quality than MIDI =]) is that synthetic sound files are very nice, compact, and small. Thus they are the most bandwidth-efficient solution to adding sound effects or cheezy musical themes to your site. You'll probably find applications of MIDI music in synthesizers (which create MIDI music) and Atari-type/old PC games.
WAV files are to music as bitmap files are to imaging.
Since this is an HTML tutorial, I'll skip to the good stuff: adding a MIDI to your webpage. The simplest way to do this, if you hypothetically had a MIDI music file called sound.mid, would be to make it play in the background. Microsoft Internet Explorer supports a tag called <BGSOUND> (which was never adopted by Netscape Navigator). Below is an example of how it works (and click here to load an example):
Just insert that after your <BODY> tag to add cheezy music to your webpage. To make the music repeat itself, just add in the LOOP attribute. If you set its value to 0, -1, or infinity, it will execute the MIDI file indefinitely.
What about Netscape Navigator? This lucky little browser requires a plug-in called Crescendo to play MIDI files - which makes it a great way to avoid the noise if you refuse to download this plug-in :) But what if you did want to add support for it? The simplest form of the required tag looks like:
<EMBED SRC="sound.mid" WIDTH=10 HEIGHT=10>
The above code only works if your web server allows Crescendo and midi mime types, that's why you have two alternatives: the Netscape Only or Netscape and Internet Explorer supported tags. The following code will make Crescendo compatible only with Netscape Navigator:
To make Crescendo compatible with only Netscape Navigator/Communicator use the following code: <EMBED TYPE="music/crescendo" SONG="yourmidifile.mid" PLUGINSPAGE="http://www.liveupdate.com/dl.html" WIDTH=200 HEIGHT=55>
To make it compatible with both of these popular browsers, use this:
<OBJECT ID=Crescendo CLASSID="clsid:0FC6BF2B-E16A-11CF-AB2E-0080AD08A326" HEIGHT=55 WIDTH=200>Real Audio is another sound compression format that can be dynamically streamed through a Real Audio/Video server or psuedo streamed via HTTP. Visitors will need to download the real audio player but nevertheless, it is decent at streaming media files. This is one of the most popular audio types although sound quality is not good as a WAV or MP3, it has the advantage of smaller size and ease of streaming (instead of having your visitor wait for the entire sound clip to load). Video and mp3s tend to jump/skip a lot unless you have a very good internet connection. To create Real Audio files, you should go grab the freely distributed Real System G2 Authoring Kit which includes utilities to author and teach you about Real Audio G2,RealPix and RealText.
Beatnik is another sound compression tool sounds like it has promising results. Here is a clip of their promo: "Under its Headspace label, Beatnik composes digital music that will complement a wide range of web sites. RMF (Rich Music Format) is an audio file format created by Beatnik for online playback through the Free Beatnik Player ... Many files are around 10k, and almost all files are under 100 K for up to 5 minutes of music." Check out the Beatnik website for more details on how to "sonify your site."
Last Updated 8.16.99
©1999 Team 26297 "Ad Infinitum Web." All rights reserved. Any reproduction of this document for commercial or redistribution purposes without the permission of the author is forbidden.