Using Sound

Well, assuming you have a sound system and it's enabled, and you're using a fairly current Netscape or IE browser, you should be hearing a background sound shortly. Please stop reading for a moment, look up at the ceiling, and think about how the sound makes you feel.

Just what I thought! Some of you actually liked it! Drat! My point was going to be that forcing sound on your guest is often considered intrusive and not a polite practice. Unfortunately, I'm such a softy that I went and selected a pretty pleasant melody, almost like you'd hear in the dentist's office. I should have selected that blaring "Bandstand" tune that comes on in the Frames vs. Tables topic. Well, you don't have to agree with me, I suppose.

The purpose of this topic is to review a few sound files that are commonly used on web sites, some thoughts on how we can effectively use sound,  and how some of them are implemented. We'll see  some examples along the way.

First, I have a surprise for you. I learned how to stop background music! If you click the button below, I'll take you to a special sound control and then you can come back here. If you're one of the ones who liked the music, you can just go tinker with the control and leave it turned on.

There are two very common sound files on web sites, and a third that's becoming ever more popular. The first two are wave files .wav and midi files .mid , and the third is basic audio .au. These formats are supported by all PCs today, if not by a browser plug-in, then by the Windows media player.

Wave files are best avoided on web sites because they are huge. Just a few seconds of voice recorded at low resolution can be 200K or more. In my view, they are often gimmicky and not worth the web space and download time. rodney.jpg (4761 bytes)They do, however, create sound that is very true to life and the sound can be either voice or music. Also, their  advantage is that anyone with an $8.00 microphone and a sound card can make a wave file. All basic Windows and MAC computers have the requisite software, like Windows' Sound Recorder applet. Wave files can certainly be fun, but for most web sites, I question their utility. As an example, here's a clip I obtained from Rodney Dangerfield's web site. It takes 56K for him to deliver his signature line but I'm a fan and he's worth the download time to me.

Midi files are quite different from wave files. They are relatively  small and can play a long time for their size. Midi files do not include voice, generally feature a specific instrument or two accompanied by a synthesizer, although they can sound fairly rich, almost orchestral. They are relatively difficult to create compared to wave files and I know of no way to convert between wave and midi or cd-rom and  midi, as you can do with MP3 files.  The person or group doing the recording play their melodies into a device attached directly to the midi input on the sound card where it is captured by special software.  As it was explained to me, midi files compare to wave files much as vector graphics compare to raster, or postscript files to bitstream. That is, they are streams of instructions to be acted upon logically by software, rather than streams of bits to be sent directly to hardware.  This would explain the difficulty converting them.

I'm a big fan of midi music and try to incorporate it into my web sites  whenever it might be even remotely appropriate. If kept short, an appropriately selected midi tune can add a nice mood toThe Background Music Man certain pages. It especially can bring a burst of humor to a dry subject! My attitude toward midi music is always evolving, but I have a constant concern that my guests might find it disturbing. I managed to sneak one into a couple topics, Frames vs. Tables and Biography,  and  here of course.  A favorite is one which came with my Turtle Beach sound card as demo material. It's very stereophonic and a good test of your sound system. (If you get an error that your midi port is in use, turn off the background sound.)

The third type of file, .au, is usually found in Java applications. From my exposure to them, they are used more as sound effects than they are for melodies. They are generally very light-weight, say 1K to 8K. For these reasons, they lend themselves well to web sites where gentle, almost subtle audio feedback is desirable, say as a mouseover effect within a navigation bar .... and without a heavy download penalty. If we look at the main page of the web site I did for my son's business, you'll see the java navigation elements on the  left have sound effects. I took you there in the Java topic, so you may not want to go again,  unless you missed it.

Sounds used as 'effects' are only as clever as you are, but when done well, they can break up the monotony of a web page, yet  without being distracting or offensive. Here's an example I created just for this topic. (Please turn off the background sound before you click it.) You'll get the effect when you place your mouse over the cat's thumbnail, and it could just as well been done on the 'click'. I embellished this by using an alternate graphic for additional mouseover emphasis. Users tend to enjoy this, but probably not a good idea for the N.Y. Times and Wall Street Journal sites. By the way, I put this together using FrontPage 2000's 'hover effect' which creates a java applet.

Since I enjoy classifying things,  I'll group web sounds into 3 categories: Sound Effects, Core Sound, and  Background Sound.

Sound Effects need no additional explanation. I think the examples here will provide you with sufficient food for thought. I plan to research .au files to understand how they're created and to learn why they seem to be the province of Java Applets.

Core Sounds are at the "core" of the web site that uses them. It's their stock in trade and without core sounds, the web site would likely not exist. They are never intrusive because the user knows to expect them and wants them. I'm going to provide 3 links here to sites that employ core sounds. All three sites are totally different from one another and are worthy of your inspection.

1.  NetRadio Music: Their venue is to promote different genres of music and sell that music by offering samples. Visit NetRadioTheir music is 'streaming music' which flows to your PC continously in 'real time'. As the internet becomes faster, these sites will be everywhere. At the present time NetRadio supports the Real Audio browser plug-in and the current version of the Windows Media Player. They provide links for you to obtain either, FREE.

2.  MaMaMedia: This is a terrific fun site (music, games and pastimes) for children (and young at heart adults)! You have to see it Visit MaMaMedia(and hear it) to appreciate the unusual and brightly colored graphics and the wonderous, full-bodied, and catchy sound.  If someone is feeling blue and this site doesn't perk them up ... they're probably under-medicated.

3.  ON24: I ran into this site from Yahoo Financial. They're referenced a lot as having multimedia business Visit On24reports. They generate video and audio clips, or just audio clips, to convey business and stock market news. The video part is intermittent depending on internet performance and likely my ISP connection as well. Their technology will advance quickly as the internet speeds up and DSL and cable modems become more prevalent.

Background Sound: This category is the most prevalent on non-core websites and we've seen it sufficiently here that I don't need to describe it further. The thing to remember is that background music can be automatic or optionally selected by the user.

There will be times when you know that's it's Ok, that your visitors will not be offended, even though they never opted to listen to it. I knew it was Ok to do the 'dancing kitty' routine. It's cute and, more important, it is peripheral to the main topic which references it. It's quick, doesn't persist for a long enough time to get on anybody's nerves, and it can be shut off immediately by closing its window.

Another item I've used appeared in my Java Applets topic and it also is not intrusive in any way, is non-persistent, and it provides a mood  uplift, though not in a humorous way. If you'd like to see it here, click .

So, for the long-running background music, you have to decide for yourself whether its use enhances your web page. If you're sure it's fine and you set it to play only once, then go for it. If you're not sure, then don't do it. As for the use of a control like I have done here, that's not common and the control is a bit unsightly. I stashed mine at the bottom of the page for that reason.

The other side of the coin, however, is to offer your reader the option to select a sound file. If it's a large wave file (over 100K), indicate the size, generally by placing something like (156KB) right next to the link for the file. If it's a small wave file or most midi files, then you needn't worry about download time implications. If your reader opts to play the file, then it can't be obtrusive, by definition. The trick is to offer sound files that the user would even care about, and that's your design decision.

I'll wrap up this topic by showing you what I know about placing a sound file in your web page. This is not well documented in the HTML literature I've seen and is subject to change as we go to newer browser versions.

Historically, Microsoft implemented background sound through a special <BGSOUND> tag, placed in the <HEAD> portion of the HTML page. The syntax to play the background sound in this topic, and without any controls, is as follows:

<BGSOUND src="sounds/koolthin.mid" loop="1">

Netscape never went along with this, and to this day does not support it. Instead, it offered a much  loftier implementation via the <EMBED> tag which is used for images and other objects. As it applies to sound, there are various parameters that are optional which do different things. The syntax in this page is the following:

<EMBED src="sounds/koolthin.mid" type="audio/midi" autostart="true" loop="true" width="145" height="60">

Starting with Internet Explorer 3.x, Microsoft began supporting Netscape plug-ins, and the sound files we're concerned about here are included. Therefore, when I tested the above embed command with Netscape 4.7, 6.2 and IE 4 and 5, I expected it to work with both, and it did. The only difference was the size and shape of the control console placed on the page.

Designers used to place both BGSOUND and <EMBED> in their pages so that it would work with both browsers. I removed the BGSOUND implementation because it was now redundant and it interfered. HTML 4.0 now has an <OBJECT> tag which will eventually replace <EMBED>.

I don't want to have you think I understand all the ramifications of the <EMBED> command, but I discovered certain things empirically and others from reading references. In the above syntax, adding "hidden" would remove the control from the page; otherwise it defaults to showing the control. The width and height are important now since they define the size of the control, and the numbers I picked seemed about right for both Netscape and IE. The autostart="true" is what causes the embedded object to play immediately. Finally, the  loop="true"  parameter indicates to loop endlessly. I believe that a value of 1,2 ... etc. will generate that number of iterations.

If this type of thing interests you, I would suggest a good book on HTML and also using the terrific tool called HTMLIB which is free. See my topic Reference Material [HTML]. It recommends a book and also has the current version of HTMLIB available for download here. There's also an HTML tutorial you can read here at Sam's Web Stop. There is also good information on the Internet if you search on "html embed sound".

I enjoyed doing this topic and hope you had fun as well.