T7L2

Audio and the Web

Introduction

Audio files have been used on the Web since its early days. However, problems of large file size and limited bandwidth can prove daunting to Web page developers. This lesson will introduce digital audio in general and on the World Wide Web. By the end of this lesson you should be able to:

· Describe the concept of digital audio and some of its features.

· Describe popular audio formats used on the World Wide Web.

· Discuss hardware and software requirements for audio creation, editing and playback.

· Create a hyperlink to a sound file or embed a background sound into a web page.

· Describe the purpose and use of audio plug-ins and players.

· Locate and use online libraries of free sounds.

· Discuss copyright issues as they pertain to audio files.

Start your explorations with these topics:

· Digital Audio [[link to this]]

· Popular Audio Formats on the Web [[link to this]]

· Creating and Editing Audio Files [[link to this]]

· Playing Audio Files [[link to this]]

· Putting Audio on a Web Page [[link to this]]

· Copyright and Intellectual Property Issues [[link to this]]

To round out your explorations, make sure you complete the last two sections:

· Activity [[link to single html page on this]]

· Audio Summary [[link to single html page on this]]

Additional Resources

Here are a few sound libraries and collections:

WavCentral [[http://www.wavcentral.com/]] - Very large library of WAV files

Geek-Girl [[http://www.geek-girl.com/audioclips.html]] - List of sites offering sound files in various formats.

Partners in Rhyme [[http://www.partnersinrhyme.com/]] - Huge archive of free and inexpensive sounds plus software.

Angelfire [[http://www.angelfire.com/mo/keytrax/AudioLibrary.html]] - Key Trax audio library.

Software, Info and other stuff:

MIDI world [[http://216.149.218.135/index.htm]] - lots of info, drivers, files, etc.

Cool Edit Pro [[http://www.syntrillium.com/]] - audio software.

Motion Pictures Experts Group [[www.mpeg.org]]

LiveAudio [[http://www.emerald.net/liveaudio/]]

Rec.audio newsgroup FAQS [[http://www.faqs.org/faqs/AudioFAQ/]]

Audio toolbox [[http://opera.cbc.ca/toolbox.htm]]

Tucows audio editors for Windows 95/98 [[http://epix.tucows.com/audioedit95.html]]

Sound cards info from C/NET [[http://computers.cnet.com/hardware/search/1,10121,0-7073-402-0,00.html?ob=1]]


Digital Audio

It is important to remember that the World Wide Web is merely a means of distributing computer files. The user's Web browser has the job of determining the type of file served and launching the appropriate software to display (play) it. Web Audio can be delivered in two ways:

· Static - The entire file is downloaded to the client system and then played.

· Streaming - The file is played as it is being downloaded from the server.

This lesson will focus on static Web audio. See the lesson on Streaming [[link to T7L4]] for more information on streaming Web audio and video.

What humans perceive as sound is actually vibration in the medium surrounding the ear. (This medium is typically air, but one can hear sounds when underwater.) The vibration, resulting from moving density waves in the medium, may be visualized as a waveform, whose properties of (frequency, amplitude, etc.) determine the 'sounds' we perceive. The human auditory system and brain then interpret these sounds and give them meaning -- such as speech, alerts, music, and so on.

[[how about a graphic showing this (cartoon?)]]

When sounds are digitized, their waveform is measured at regular time intervals and numeric values are assigned. This process is known as sampling, and the number of measurements per second, expressed in kilohertz (KHz), is the sampling rate. One objective of digital audio is to be able to reproduce the original waveform as closely as possible -- which is reflected in the quality of the audio. Low-quality digital audio (low sampling rate - eg. 8 KHz) will sound tinny, artificial and 'chunky.' High-quality digital audio (high sampling rate - eg. 48 KHz) will sound realistic and dynamic. Note that the reproduction does not need to be exact, it merely needs to be able to reproduce the sound to within the threshold of human audio perception.

[[show wave diagrams showing different sampling rates & how that converst toa digital signal]]

When digitizing sound, the precision of the measurement can also affect sound quality. This is called the sampling bit depth. It typically ranges from 8 bits (poor quality) to 16 bits (CD quality).

However, a major tradeoff occurs between sound quality and the size of the resultant audio file. Higher sampling rates and/or greater bit depth result in larger files. For example, a one-second digital audio file sampled at 44.1 KHz with a 16-bit depth, will result in a file approximately 1.4 MB in size. When bandwidth is considered, it is clear that the Web developer must give careful consideration to this tradeoff.

Another property of audio files is their number of channels. Each channel is an independent waveform. A common example is two-channel, or stereo, sound. With stereo, the channels are routed to a left speaker and a right speaker. The result, when perceived by a human, is sound with 'depth.' Audio files can contain from one to six channels. One-channel audio is the familiar mono sound. Three to six-channel audio can be used for quadraphonic or surround-sound.

Finally, in an effort to reduce the bandwidth/quality tradeoff, some digital audio formats include compression. This is when the digital information is mathematically processed to reduce the file size. As an example, the MPEG format uses a lossy compression scheme that filters out sounds not audible to the human ear. This results in compression rations of 4:1 to 12:1 without compromising perceived sound quality.

Reflective Questions

[[Objectives

After reading the above information and answering the following reflective questions, you should be able to:

· Explain the properties of sound affect the perceived sound and its quality.

· Evaluate the tradeoff between file size and sound quality. Discuss how to evaluate the quality of a sound for a given application.]]

1. Discuss how the various properties of sound (sampling rate, bit depth, etc.) affect the perceived sound and its quality.

2. Discuss the tradeoff between file size and sound quality. How might one evaluate 'good enough' sound for a given application?

[[reflective questions can be shared in a CMC format at the instructor's discretion]]


Popular Audio Formats on the Web

There are many formats for digital audio files. The format of a file specifies how the numeric information is recorded into binary digits (bits). The file format is also (by convention) noted in the filename extension for the file. In this way the browser will be able to determine the file format and launch the appropriate plug-in or viewer application.

Following are the MIME types, and some information about, popular audio formats used on the Web:

· AIFF -- the Audio Interchange File Format was developed as the standard audio file format for the Macintosh, although it is now supported on MS-Windows. It can support up to six channels with arbitrary sampling rates and bit depth. Its performance is similar to WAV. Its files have the filename extensions .aif or .aiff

· u-Law -- u-Law (written with the Greek character 'mu') is the standard audio format on Unix systems. It supports up to 2 channels, variable bit depths and a number of sampling rates. Its popularity as an Internet audio format is waning because other cross-platform audio formats provide better sound quality. Its files have the filename extension .au.

· MPEG (including MP3) -- is a family of multimedia standards created by the Moving Picture Experts Group. It supports static audio, static video, and streaming audio/video. MP3 (MPEG-1 Audio Layer-3) has become a popular format for recorded music. Filename extensions include .mpg, .mpeg, .mp2 and .mp3.

· WAV -- the Wavform audio file format was developed for use on MS-Windows systems, but is now also supported on the Macintosh. It can support arbitrary sampling rates and bit depths. Its performance is similar to AIFF. Its files have the filename extension .wav.

· MIDI -- The Musical Instrument Digital Interface is a standard for interfacing musical instruments. It has also become a standard for providing direct instrument input to computers. However, it differs from the other audio formats listed here in that it does not contain digitized waveforms. Rather, a MIDI file contains mathematical formulas that 'describe' the music. (Similar to musical notation.) A MIDI player then 'plays' the music using the sounds available on the client system sound hardware. Because of this, MIDI files can be extremely compact. MIDI files have the filename extension .mid.

Reflective Questions

[[Objectives

After reading the above information and answering the following reflective questions, you should be able to:

· Compare and contrast two digital audio formats.

· Describe a situation in which one digital format may be more desirable than another.

· Describe the necessary properties of a digital audio format.]]

1. Discuss and compare any two digital audio formats. In particular, discuss any situations where one format may be more desirable than another format.

2. Discuss the concept of a digital audio format. What properties should a digital audio format have?

[[reflective questions can be shared in a CMC format at the instructor's discretion]]


Creating and Editing Audio Files

Digital audio files may be created and edited if you have the proper audio hardware and software. Required hardware would include audio processing circuitry and ports for audio input and output. Optional hardware might include speakers and a microphone. Some personal computers, such as the iMac, come with audio hardware standard. Other personal computers provide audio hardware as an option.

For example:

· Dell PC with Creative Labs 'Sound Blaster' card, and Labtech ATX-5820 speakers.

See the Resources section at the end of this lesson for hyperlinks to audio hardware information.

Audio development software is used to create and edit audio files. This includes software for digitizing audio, mixing channels, transforming waveforms, converting formats, compression and special effects. A user trained in these programs can sculpt audio files in the same way that one trained in use of a graphics package can manipulate images.

For example:

· Internet Audio Mix, a shareware multi-track recorder and sound mixer available through www.acoustica.com.

See the Resources section at the beginning of this lesson [link to this]] for hyperlinks to audio hardware information.

Reflective Questions

[[Objectives

After reading the above information and answering the following reflective questions, you should be able to:

· Compare and contrast features and prices of audio cards.

· Recommend and justify which audio card would be best to use.

· Compare and contrast hardware requirements and prices of audio programs.

· Recommend and justify which audio program would be best to use.]]

1. Use an online site to gather information about a few audio cards. Compare their features and prices. Which would you recommend and why?

2. Use an online site to gather information about a few audio programs. Compare their features, hardware requirements and prices. Which would you recommend and why?

[[reflective questions can be shared in a CMC format at the instructor's discretion]]


Playing Audio Files

Once downloaded from the Web, an audio player or plug-in must be launched to play the audio file. See the lesson on Browsers for more information on plug-ins. [[link to T2L4]] The player or plug-in has to be able to read the audio file format in order for this to work. One of the differences between the various players and plug-ins is the set of formats they will handle. Following are a small set of audio players and plug-ins.

· LiveAudio -- this is an audio plug-in for Netscape 3.0 and later, that handles a variety of sound formats. (It is distributed with Netscape.)

· Microsoft Media Player -- this is a multimedia program distributed with current versions of Microsoft Windows 98/NT/2000. It is also available as a plug-in for Netscape. MMP handles a variety of audio, video and streaming formats.

· RealJukebox -- this is an audio file player and management system from Real Networks. Although typically used to manage collections of MP3's, it can play a variety of audio file formats.

Reflective Questions

[[Objectives

After reading the above information and answering the following reflective questions, you should be able to:

· Compare and contrast two or more applications for playing digital audio files on their features, performance, and price.

· Recommend and justify which application would be best to use.]]

1. Use an online resource to examine and evaluate two or more applications for playing digital audio files. Describe how they differ by feature, performance and price. Which product would you recommend?

[[reflective questions can be shared in a CMC format at the instructor's discretion]]


Putting Audio on a Web Page

There are two ways to add audio to a web page.

· As a hyperlink to an audio data object.

· As a background sound.

Creating a hyperlink to an audio file data object is very simple. Merely use the <anchor> tag to link to the audio file. An inline image may be used as the hyperlink, to provide a button for the sound as opposed to a text string.

As an example, the following anchor will load and play a WAV file containing a police siren:

<a href=" http://dcwi.com/~IB/siren.wav">police siren</a>

A background sound may be added to a page for Netscape browsers by using the <embed> tag. The audio file will then load and play when the page is displayed.

Following is an example that will load the sound file "bells.mid" and play it when the surrounding page is displayed:

<embed src="bells.mid" hidden="True"></embed>

The HIDDEN="True" attribute in the <embed> element forces Netscape to not display the control console for playing of the sound file.

Background sound may be added to a page for Microsoft Internet Explorer (MIE) through use of the <bgsound> tag, as in the following example:

<bgsound src="bells.mid" loop=5>

The 'loop' attribute tells MIE how many times to play the sound. If the value of loop is set to 'infinite,' the sound will play continuously. Note: This ONLY works in MIE!

A background sound may be placed on a Web page in a way that satisfies both Netscape and MIE by using a combination of these techniques, as follows:

<embed src="bells.mid" autostart=true hidden=true></embed>

<noembed><bgsound="bells.mid"></noembed>

It is also possible to use client-pull to load and play the audio file, as in the following Example:

<meta http-equiv="refresh" content="5;url=bells.mid">

This will cause the file "bells.mid" to refresh and play every 5 seconds.

NOTE: It is generally considered bad design to have background audio files that automatically play upon page entry.

See the lesson on Images and Objects for more information on embedding [[link to T3L4]].