Multimedia Web pages:Adding sound

Whether it's important content or just for fun, when you add sound to your Web page you're adding a whole new dimension of experience for your visitors to enjoy. In this tutorial, the first in a two-part series on multimedia Web pages, we explore ways in which you can add audio to your Web site, including downloadable files, MIDI background music, and streaming audio. Watch out for a tutorial on adding video to your Web page in next month's issue of ANG.

[by Nicole Manktelow]

Adding sound files that users can download is the easiest way to add audio to your Web page. Small sound files are quick to download and the quality of the sound is preserved. Many Web sites successfully include sound effects, audio snippets from TV and movies and quotable quotes in this way. (Having arranged copyright clearance, of course.) To access these files, users simply click on a link. If the file type is recognised by their browser or a plug-in, the file will begin to play as soon as it is completely downloaded.

If a browser is not configured to play back audio, the user will be asked instead to Save to disk, after which they can play back the file using programs such as Windows' MediaPlayer, Simple Sound, Simple Text, or Movie Player on the Mac.

No matter what platform you're using, try to cover all the bases by including different options for file formats. .wav and .au formats should cater for most users. You should be able to save sound files in any of these file formats (and more) using a sound editing program.

Handy Tip

If you're adding many sounds to your page, create a separate directory at your Web page work space on the server to keep things nice and tidy. Double-check that your files are all in lower case and in the correct directories.

Make sure you tell visitors the name of the file, what sound the file contains, and how big the file is. You may also want to indicate how long the file may take to download at 28.8kbps.

Use this code:<\<>A HREF="sounds/filename.wav">filename.wav<\<>/A<\>> in your Web page to add a link to the sound file. For example,"I don't care" (2 sec, 38.1KB) <\<>A HREF="sounds/care.wav"<\>>.wav<\<>/A<\>> <\<>A HREF="sounds/care.au"<\>>.au<\<>/A<\>> tells visitors to my site that the sound file says, "I don't care", runs for 2 seconds, is 38.1Kb and is available in either .wav or .au format. Visitors to the site can download either of these files by clicking on the '.wav' or the '.au' which are hotlinks.

Files, sizes and compression

Making your files as small as possible is going to require some compromise. It would be nice to be able to offer the highest quality sound files over the Net, but high quality demands larger file sizes, and large files may not impress the visitors to your Web page who'll have to wait for these download.

Most computers nowadays have 16-bit sound cards. You may see advertising on some sound card products that create the impression the card uses 32-bit technology. This is not the case. In fact, there's no such thing as 32-bit when it comes to sound. (16-bit sound is what you get when you play a CD on your stereo system.) Dropping your sound file from 16-bit to 8-bit will reduce file size substantially, but since most users will be hearing it via their computer speakers, the difference will be almost negligible, particularly if the sound is a voice.

The other most significant way to reduce file size is to convert a stereo file to mono. Obviously, you won't want to do this to a special stereo effect, but less complicated sounds or sound effects may not need to be in stereo. You can explore the options for reducing your file size by using the Save As option in your sound editing software. Remember to preserve the original, and make changes to copies.

Zip files remain a simple alternative for large sound files. WinZip, for example, will allow you to zip (compress) a sound file and include a link to the file on your Web page. Users can then download the zip file, and (using WinZip), unzip and play it with their sound software.

You should be aware of how long it will take a visitor to download your files. You can extrapolate on the assumption that 100Kb takes about five seconds to download via a 28.8 modem. But of course, download times can very greatly. Your connection speed is important, but so is the general pace of the bandwidth. The more users utilising the same part of the network, the less bandwidth there is to spare.

Give them a MIDI

MIDI files are another way to incorporate music into a Web page. MIDI files are not sound files. MIDI stands for Musical Instrument Digital Interface and essentially contain the information that tells your sound card what sounds to create. MIDI files can be embedded into a Web page and are tiny compared to .wav files of the same duration. MIDI files can be used to provide background music for a site.

To embed a MIDI file in my Web page, I included the following code:<\<>BGSOUND SRC="filename.mid" LOOP=99<\>> for Internet Explorer and,<\<>EMBED SRC="filename.mid" width=200 height=55 autostart=true loop=99<\>> for Netscape 2 and up, or a MIDI plug-in such as Crescendo.

It's good manners to include a link to a page from where visitors can get a plug-in if they aren't already equipped for MIDI files. LiveUpdate is the company that makes Crescendo, and besides the software, you also get music to add to your site (http://www.liveupdate.com).

Streaming

Streaming is a method of delivering audio without the user having to download the whole file first. It's better for larger files since the user doesn't have to wait for the entire file to download before being able to hear something. Streaming can be set to provide music that users can click to hear, or it may be activated automatically as background music. Live Net broadcasting, and radio-style Web sites use streaming technology to deliver audio.

For prerecorded sound, Shockwave for Audio is possibly the most accessible streaming technology for home Web page builders because all that is required is an investment in some software, as opposed to a special server needed for other streaming methods. Files saved as Shockwave for Audio (.swa) take advantage of impressive compression techniques, making the technology ideal for showcasing lengthy musical pieces.

Shockwave has been developed by Macromedia to allow Macromedia Director to create multimedia elements for the Web. Users can convert sound files to the .swa format via Director and a free downloadable Xtra (similar to a plug-in).

For more information on developing in Shockwave, check out http://www.macromedia.com./shockwave/config.html.

Getting the sound

Before you can add the desired sounds and music to your Web page, you have to get them onto your computer, and into a form you can work with.

Sounds can be simply recorded using a basic microphone like those often provided in multimedia kits or packaged with your computer. Not surprisingly, the quality of recordings made with these microphones is pretty low. Another option which can be inexpensive and may even produce better sound quality is to import prerecorded sound into a program such as CoolEdit. Musicians may have a few recorded demos lying about the place anyway, or discover an old, previously undiscovered recording of the Beatles (well, one can only hope).

Enthusiasts may already have gear such as synthesisers and MIDI interface cards hooked up to their computer, which will allow them to generate a great many different sounds, and even entire musical pieces.

Although this may sound tempting, you should refrain from recording sound bites from your CD collection. Unless you are using copyright free sounds or sound effects compilations, recording directly from a music CD will almost certainly infringe copyright regulations and you might find yourself being sued by a big company like Sony.

Sound editing software

Sonic Foundry Sound Forge This is the software included in Macromedia's Director Suite of applications for Windows 95. It has an RRP of $1895. Sound Forge can be purchased separately for $695.

Sound EditConsidered an industry standard, Sound Edit is sold as a two-pack with Deck II (multi-track recording software) for Macintosh and has an RRP of $695.

http://www.macromedia.comCool Edit Shareware sound editing at its very best, Cool Edit is for Windows 95 and 3.1 and pricing starts at $US25.

http://www.syntrillium.com

The Web Developer's Guide to Sound and Music
Anthony Helstetter and Ron Simpson
Coriolis Group Books
RRP $80.00 The Web Developer's Guide to Sound and Music provides an in-depth look at making, recording and manipulating sound, as well as the mechanics of adding sound to Web pages. It also looks briefly at streaming and the necessary servers. The book comes with a CD-ROM of sound files, examples and trial software.


 
 

 

 
[home] - [daily] - [monthly] - [guides] - [tutorials]

 

This site brought to you by ANG, Cyber Publications and OzEmail
© 1997 Cyber Publishing