by Mark R. Brown and Mike Morgan
With any emerging technology, being first presents a tremendous advantage. RealSystems (formerly Progressive Networks) (www.real.com) was the first company to deliver real-time streaming audio over the World Wide Web. Because it is being used by so many professionals, their product, RealAudio, illustrates the process of adding streaming audio to your HTML documents. Other plug-ins have different requirements--for example, many do not require special server software--but you'll find the process is more similar than it is different for embedding different audio formats into your HTML documents.
NOTE: Real System's latest product, RealPlayer, combines their streaming audio and streaming video protocols. We'll talk about streaming video in Chapter 28, "Streaming Video." Although we'll use RealAudio as the example in this chapter, chances are you may opt to handle streaming audio by installing RealPlayer on your computer.
You can get more information about RealPlayer at http://www.real.com/products/player/index.html. You can learn more about RealNetworks at http://www.real.com/corporate/index.html.
Since its introduction, thousands of Web sites have begun to deliver RealAudio content over the Internet. Today, it is undoubtedly the most popular streaming audio application on the Net, with more than 8 million RealAudio Players downloaded from the RealNetworks Web site.
RealAudio files are digitized audio; that is, they start out as analog sound, which is fed through a sound card and digitized into a stream of digital bits.
RealAudio is actually a suite of three programs that work together. The RealAudio Encoder encodes preexisting sound files or live audio streams into the RealAudio format. The RealAudio Server delivers these encoded RealAudio streams over the Internet or your company intranet. (A RealAudio Server and a Web server are often run simultaneously on the same server computer.) Finally, the RealAudio Player plays these streams when they are received by your computer. Versions of all are available from the RealNetworks Web site at http://www.real.com/ (see Figure 27.1).
The RealNetworks RealAudio site is a treasure trove of downloadable software, technical information, and audio streams.
If you're just planning to listen to RealAudio on the Web or on your company's intranet, all you need is the RealAudio Player. If you want to publish RealAudio content for your Web server to deliver, you also need the RealAudio Encoder. If you run your own Web server, you need the RealAudio Server, as well.
NOTE: RealNetworks supports the LiveMedia Real-time Transport Protocol (RTP) and Microsoft's ActiveMovie Streaming Format (ASF) in all their RealAudio products.
RealAudio streams are compressed and encoded from either a preexisting sound file or live audio. The RealAudio codecs can output files that are optimized for 14.4Kbps or 28.8Kbps modem delivery, or delivery over a higher speed line such as the Integrated Services Digital Network (ISDN). (If a file is intended for delivery over a fast direct Internet or intranet connection, use the high-bandwidth ISDN codec.) The resulting file is always much smaller than the original. For example, a one-minute monaural .WAV file (sampled at 22 kHz) takes up about 2.6 megabytes; the RealAudio 4.0 version, encoded with a 6.5Kbps codec, is only 42 kilobytes in size, whereas the ISDN version is about 296 kilobytes. These numbers represent compression ratios of about 62:1 and 8:1, respectively. The resulting low-bandwidth RealAudio file has a quality comparable to an AM radio broadcast and is best for speech only, whereas the quality of the high-bandwidth codec approaches CD-ROM quality and is adequate for stereo music.
The compression routines in the RealAudio Encoder leave out some sound file information; that's the nature of compression. You give up a little quality for a great gain in transmission speed. These omissions appear in the resulting audio stream as a sort of "graininess" or loss of depth and tone quality.
If you're familiar with the technical aspects of the World Wide Web, you know that the HyperText Transfer Protocol (the protocol of the Web) uses a connection-oriented communications method called the Transmission Control Protocol (TCP). The RealAudio Server delivers audio streams in a different manner. The TCP protocol, upon which the Web is based, emphasizes reliability. TCP ensures that accurate data packets are always received, even if that means retransmitting some of them to overcome errors. A different protocol, the UDP protocol, emphasizes speed, sometimes at the cost of reliability. Sacrificing reliability is bad when you're talking about sending a Java applet, for which every bit counts. Inaccurate or incomplete audio transmissions are interpreted by your ears as just a little noise, like a skip or static in a radio station signal. Much more important to audio is the uninterrupted transmission of the signal so that large blocks of audio aren't skipped and transmission continues in real time. For that reason, RealAudio uses a special server program to deliver RealAudio data packets by using the UDP protocol. Though using this program may mean an occasional skipped "sound byte," it means the data stream continues on, uninterrupted, in real time.
NOTE: To get around the problem of occasional packet loss, the RealAudio Server incorporates a loss correction system that minimizes the impact of lost packets. This system works well when packet loss is in the 2 to 5 percent range, and even works acceptably when packet loss is as high as 8 to 10 percent.
A RealAudio Server connection is actually a two-channel, two-way communication system: UDP is used for sound-data transmission, and TCP is used to negotiate the proper bandwidth based on the codec as well as to communicate pause, fast forward, play, and rewind commands. Because of this two-channel communication, you can listen to a RealAudio stream just as you would an audio tape. Because the stream is delivered to your computer on demand, in real time, the RealAudio Player's commands to the RealAudio Server can jump you back and forth to different spots in the audio stream. (Of course, this feature works only for prerecorded audio; live audio broadcasts are like listening to the radio.)
NOTE: RealNetworks developed RealAudio as an open architecture application and encourages RealAudio development by third parties.
The Playback Engine Application Programming Interface (API) provides software developers with direct access to the functionality of the RealAudio Player so that commercial Web authoring tools and other applications can incorporate RealAudio streams.
The Encoder API allows developers to use a variety of audio compression algorithms with RealAudio. For example, you can use Macromedia's SoundEdit 16 on the Macintosh to save sound files directly into the RealAudio format. Visit http://www.macromedia.com/software/sound/ to learn more about this product.
The RealAudio APIs are available as part of the RealMedia Software Development Kit, available from the RealNetworks Web site at http://www.real.com/devzone/sdks/index.html.
When you download the RealAudio Player for Windows 3.1, Windows 95/NT, Macintosh, or UNIX, you tell the server what connection speed you use. The server uses this information to choose the codecs that are appropriate for your machine. You get two versions of the RealAudio Player: one is a stand-alone program that can also be used as a browser helper application, and the other is a browser plug-in, with versions available for both Netscape Navigator and Microsoft Internet Explorer.
The RealAudio stand-alone application (shown in Figure 27.2) is a fully functional program that you can use to play RealAudio files from any source, including your own hard drive, a corporate intranet, or the World Wide Web. It's one of a growing number of applications that can access the Web independently of a browser program.
The stand-alone RealAudio player can be used as a browser helper application or can play sound files from any source.
Whether you listen to a prerecorded or live-audio stream, and whether it comes from your own hard drive, a local network, or the Web, a RealAudio stream will begin playing as soon as the Player has latched onto a few packets. You don't have to wait for the whole stream to load before it starts playing. Because it's a stand-alone application, you can even go on to browse other Web pages and the RealAudio file will continue to play in the background.
The Netscape plug-in is also installed automatically when you install RealAudio. It automatically plays inline RealAudio files that have been included on Web pages using the <EMBED> tag. It manifests itself as controls that appear inline in the Web page. How many controls you see depends on how the RealAudio file has been embedded. This topic will be covered in detail later in this chapter, in the section titled "Using RealAudio Content on Your Web Pages."
NOTE: If a Web page includes RealAudio content using a standard link, you'll have to click the link to hear the audio stream, and your browser will launch the stand-alone RealAudio Player as a helper application. You'll then need to close the Player after the clip is done playing.
However, if the RealAudio content is included using the <EMBED> tag, your browser will automatically use the RealAudio plug-in, and any activated controls will appear inline in the Web page. Depending on the page design, the clip may even begin playing automatically. The plug-in will remain in place until you leave the associated Web page.
Learn more about embedding multimedia content in your Web pages by reading Chapter 14, "Inserting Objects into a Web Page."
You can download the latest version of the RealPlayer setup program (which includes both RealAudio and RealVideo) from the RealNetworks Web page at http://www.real.com/products/player/index.html. Choose either RealPlayer (which is free) or RealPlayer Plus (which includes one-button scanning as well as free technical support). Select the proper version from the online form for your computer and connection speed.
NOTE: You can run RealPlayer (with both audio and video capabilities) on Windows 95 and NT systems as well as the PowerPC Macintosh. RealNetworks is also developing versions of RealPlayer for various versions of UNIX.
The older RealAudio Player runs on Windows 3.1 machines, as well as OS/2. The Macintosh version runs on 68040 Macs with a Floating Point Unit (FPU). RealNetworks has versions of the RealAudio Player for most popular versions of UNIX.
After you have a copy of the RealAudio Player (or RealPlayer) setup program on your hard drive, double-click the file you downloaded to run the setup program. After you successfully install the RealAudio player, the player automatically launches and plays a welcome message.
ON THE WEB: You can get full instructions for setting up the UNIX version of RealAudio from the RealNetworks site at http://www.real.com/help/player/unix3.0/.
ON THE WEB: If you're having trouble playing RealAudio streams through your local area network's firewalls, check out the instructions in Real Systems Tech Support Library at http://www.real.com/help/library/. You can find the documents on firewalls at http://www.real.com/help/firewall/index.html.
The RealAudio Player controls are elementary.
The Toolbar includes Play/Pause, Stop, and a Time Into Clip Indicator. It also includes Fast Forward/Rewind buttons, which work in 10-second increments, and a Home Button. The Home Button shows a spinning speaker when the Player is receiving a file and a lightning bolt when it is encountering a high data loss. Clicking the Home Button takes you to the RealAudio home page at http://www.realaudio.com/.
The Volume slider is at the right side of the Player window. Title, author, and copyright information is displayed to the left of the Volume slider in the Clip Info window. The current state of the Player is displayed in the Status Bar at the bottom of the Player window, with the play time and clip length shown in the lower-right corner.
If you're listening to a Web page with embedded RealAudio content, you may see inline versions of any or all of these controls inside the Web page, depending on how the Web page has been set up.
TROUBLESHOOTING: Why don't I hear any sound from very short sound clips? The file may be too short. Current versions of the RealAudio Player will not play files shorter than one second.
NOTE: Play, Pause, and Stop are also available from a right-mouse-button, pop-up shortcut menu, and the RealAudio Player menus are also pretty simple.
The RealAudio File menu lets you open a RealAudio file from a drive on your system or network, or from a server on an intranet or the World Wide Web. Open File (Ctrl+O) is the option for loading an .RA or .RAM file from disk or network; Open Location (Ctrl+L) lets you specify the URL of a file located on an intranet or Web site. If you use Open Recent, you'll find a list of recently played RealAudio files.
NOTE: A RealAudio URL has this format:
pnm:// indicates the file is located on a RealAudio Server system. Server:Port# is the address of the RealAudio Server. pathname is the complete directory path and file name. Here's a real-world example:
From the View menu, you can turn on or off the display of the Player Info and Volume window or Status Bar. Choosing Preferences (Ctrl+P) brings up the Preferences dialog box, in which you can set Network, Proxy, and other advanced options. The Statistics item pops up a dialog box containing information about the current connection. (The Preferences and Statistics dialog boxes are also available from the right-mouse-button, pop-up menu.) Finally, Always on Top keeps the RealAudio Player window on top of all other open windows.
The Clip menu (or the right-mouse-button, pop-up menu) lets you choose to play the Previous (PageUp) or Next (PageDown) clip. The Sites menu takes you directly to the RealAudio Home Page, RealAudio Guide, or RealAudio Help Page. The last menu, Help, has two choices: Contents (F1) and About.
ON THE WEB: You can locate plenty of cool RealAudio sites on the Internet. Want to find some practical RealAudio sound sites? Check out Timecast (shown in Figure 27.3) at http://www. timecast.com/. Continually up-to-date, Timecast is the definitive guide to live RealAudio broadcasts and the best prerecorded RealAudio content on the Web. It's all there, from ABC News and PBS specials to live FM radio and real-time sports broadcasts. You can even customize your own daily news broadcast with time-sensitive, audio content delivered live.
Timecast is the ultimate Web guide to RealAudio sites.
You use the RealAudio Encoder (see Figure 27.4) to translate audio-format files into RealAudio files. This encoded RealAudio material can then be played over an intranet or the Internet in real time, using the RealAudio Server to send and the RealAudio Player to receive.
The RealAudio Encoder lets you specify a Source file and a Destination file, and you can set Description elements. You can also choose the Compression Type in the Options window.
The RealAudio Encoder 3.0 (http://www.real.com/encoder/realaudio.html) is available for Microsoft Windows 95/NT, Microsoft Windows 3.1, Macintosh, and several versions of UNIX.
The RealAudio Encoder supports the input file formats listed in Table 27.1.
|.WAV audio||8, 11, 22, 44 kHz||8- or 16-bit, monophonic|
|.AU audio||8, 22, 44 kHz||monophonic|
|raw .PCM data||8, 11, 22, 44 kHz||8- or 16-bit, monophonic|
The RealAudio Encoder does not support compressed files. If you need to encode a compressed file, convert that file to one of the supported formats by using a sound-editing utility, such as Macromedia's SoundEdit 16.
You can download the RealAudio Encoder from the RealNetworks site at http://www.real.com/encoder/realaudio.html. Installation and setup are similar to that of the RealAudio Player described earlier in this chapter.
Because audio encoding is more demanding than simply playing back encoded files, you should be aware that RealNetworks recommends a minimum of a 486/66 CPU with 8M of RAM and 1M of hard drive space for installation of the Encoder program, plus an additional 1 to 2K of hard drive space per second of audio you plan to encode and store. You'll also need a 16-bit sound card capable of recording an 8kHz signal or higher. For a table showing the sampling rate required for each codec, see http://www.real.com/encoder/rasysreq.html.
You need to start with a sound file in .WAV, .AU, or .PCM format. The Web is a great source of a wide variety of sound files, of course. We suggest prospecting at http://www.yahoo.com/Computers_and_Internet/Multimedia/Sound/Archives/. If you want to record your own sound files, you'll need an audio-digitizing program. Most sound cards come with such a program. You can record audio from tape or other external audio sources by using your sound card's line input, or you can record live audio by using its microphone input. For the specifics of how to record sound with your particular sound card, check your sound card manual.
CAUTION: As you do with any other content on the Web, be sure you get permission before adopting the material for your site. Plenty of material is free online, but many sound files are subject to copyright.
NOTE: The RealAudio Encoder does not support compressed files or files of a format other than .WAV, .AU, or .PCM. If your file is in a different format, you can convert it to a compatible format by using an audio-file editing program. Several commercial products are available, or you may want to experiment with shareware. To find a shareware editor, visit shareware.com, pick your platform, and search for "sound edit."
You can sometimes get better results when encoding a sound file if you perform some adjustments to the file before you encode it. Almost any adjustment that makes the file sound cleaner and clearer will make the final encoded version sound better, too. Most audio-digitizing programs are capable of performing at least a few basic adjustments like equalization or noise gating. Check out http://www.real.com/help/content/audiohints.html for specific audio-editing tips.
Follow these steps to encode audio files for RealAudio. (Refer back to Figure 27.4.)
NOTE: The RealAudio Encoder 3.0 can encode live audio input directly from your PC's sound card. However, only the version of the Encoder provided with the RealAudio Server 3.0 can send the RealAudio output directly to the Server for live broadcast on the Internet. A special server utility called the Live Transfer Agent (LTA) acts as a bridge between the RealAudio Live Encoder and the Server. The LTA transfers encoded RealAudio from the Live Encoder to the Server in real time to allow for live feeds.
You can encode any sound data delivered to your sound card, including CD audio. The downloadable trial version of the Encoder has this feature disabled.
If Show Audio Signal is selected under the Options menu, you'll see amplitude graphs of the source and destination files.
A minimal set of controls is available via the Encoder menus. All these controls are intuitive, and are explained via the Help, Contents menu selection.
NOTE: The RealAudio Encoder will automatically encode a .WAV or .AU file when you drag an icon of the file to the RealAudio Encoder shortcut on your desktop.
You also can run the Encoder from the command line to encode multiple audio files automatically with options from a setting file. Complete instructions are located on RealNetworks's Web site at http://www.real.com/help/encoder/win3.0/settings.html.
After you have an .RA format file, you need to create an associated .RAM metafile. The metafile is a text file that contains a single line containing the full URL for the .RA file. A typical .RAM file might look like this:
The .RAM file containing this line would probably be called welcome.ram, to make its association with the encoded RealAudio file it calls, welcome.ra, clear. Why use an intermediary .RAM file to play an .RA file? Well, for one thing, .RAM files can contain a list of URLs for .RA files, which will be played in sequence. (Just make sure .RAM files that contain lists of .RA file URLs don't contain any blank lines!) For another, .RAM metafiles can contain timing instructions that will start an .RA file playing at some time into the file rather than at the beginning.
To add timing instructions to a .RAM file, you append the starting time to the end of the URL preceded by a dollar sign, like this:
This file would begin playing 30 seconds into the .RA file. The complete format is this:
dd signifies days, hh hours, mm minutes, ss seconds, and t is tenths of a second (note the decimal point before the t).
If you are content with having viewers of your site launching the stand-alone RealAudio player as a browser helper application, you can use a standard HTML link to play RealAudio files on your Web page, as in this example:
<A HREF="pnm://audio.realaudio.com/duck.ram">Duck Quacking</A>
This line of HTML code produces a text link labeled Duck Quacking that, when clicked, launches the stand-alone RealAudio Player. The viewer must click the Play button to hear the duck.RAM file and then exit the RealAudio Player program.
CAUTION: In general, you must have the RealAudio Server software installed and properly configured on a server host before you can use RealAudio content on your Web pages. For a different approach, read the comments on pseudostreaming in the section "The RealAudio Servers," later in this chapter.
A more elegant solution is to use the <EMBED> tag to incorporate an inline RealAudio file, like this:
<EMBED SRC=" pnm://audio.realaudio.com/duck.rpm" WIDTH=300 HEIGHT=134>
The SRC attribute specifies the URL of the RealAudio file to play. Note that, to avoid backward compatibility conflicts with the stand-alone RealAudio Player, URLs for use with the <EMBED> tag--which invokes the RealAudio plug-in--use an .RPM extension instead of the .RAM extension. In all other ways, however, files with an .RPM extension are identical to .RAM files; they differ only in the file-name extension.
The WIDTH and HEIGHT attributes specify the size of the embedded component. Unlike images, plug-ins do not size automatically. The WIDTH and HEIGHT can be specified in pixels (the default) or percentages of screen width (for example, WIDTH=100 percent).
Here's the generic syntax for using the <EMBED> tag with RealAudio files:
<EMBED SRC=source_URL WIDTH=width_value HEIGHT=height_value [CONTROLS=option] [AUTOSTART=True] [CONSOLE=value] [NOLABELS=True]>
The CONTROLS, AUTOSTART, CONSOLE, and NOLABELS attributes are specific to RealAudio, and are all optional.
The CONTROLS attribute defines which RealAudio Player controls appear embedded on the Web page. Table 27.2 lists all the valid values for the CONTROLS attribute.
|CONTROLS = All||Embeds a full Player view including the ControlPanel, InfoVolumePanel, and StatusBar. (This value is the default if CONTROLS is not specified.)|
|CONTROLS = ControlPanel||Embeds the Play/Pause button, the Stop button, and the Position slider. (Same as the stand-alone Player application with none of the options on the View menu checked.)|
|CONTROLS = InfoVolumePanel||Embeds the information area showing title, author, and copyright with a Volume slider on the right side. (Same as the panel displayed by the stand-alone Player application when the Info and Volume option on the View menu is checked.)|
|CONTROLS = InfoPanel||Similar to InfoVolumePanel, but this value embeds the information area showing title, author, and copyright without the Volume slider.|
|CONTROLS = StatusBar||Embeds the Status Bar showing informational messages, current time position, and clip length. (Same as the panel displayed by the stand-alone Player application when the Status Bar option on the View menu is checked.)|
|CONTROLS = PlayButton||Embeds the Play/Pause button only.|
|CONTROLS = StopButton||Embeds the Stop button only.|
|CONTROLS = VolumeSlider||Embeds the Volume slider only.|
|CONTROLS = PositionSlider||Embeds the Position slider (scroll bar) only.|
|CONTROLS = PositionField||Embeds the field of the Status Bar that shows Position and Length.|
|CONTROLS = StatusField||Embeds the field of the Status Bar that displays message text and progress indicators.|
If you set AUTOSTART=TRUE, the plug-in automatically begins playing the RealAudio file when the page is visited. Use this feature to begin a narration or play background music automatically. Because only one RealAudio clip can play at a time, if you specify AUTOSTART for more than one <EMBED> tag, only the last one to load will play automatically. (The order in which the source files arrive is dependent on the Web server and Netscape's cache.)
The CONSOLE attribute lets you relate any number of clips that appear on the same Web page together. Normally, each is independent; but the clips that are related by the CONSOLE attribute are controlled by the same controls. To relate two RealAudio clips on the same page, you simply give them each a CONSOLE attribute with the same name. Here's an example:
<EMBED SRC="sample1.rpm" WIDTH=30 HEIGHT=33 CONTROLS="PlayButton" CONSOLE="Clip1"> <EMBED SRC="empty1.rpm" WIDTH=300 HEIGHT=33 CONTROLS="PositionSlider" CONSOLE="Clip1">
Normally, the first clip would have an associated Play Button, and the second would have a Position slider. However, because these clips both have the attribute CONSOLE="Clip1", the Play Button and Position slider work for both clips.
You can specify a CONSOLE value of "_master" to link one clip to all the others on a Web page. Use this value when you want a control such as a StatusBar to display information for all your audio clips.
If your clip includes controls (such as InfoPanel and InfoVolumePanel) that display the title, author, and copyright information, you can suppress this information by using the attribute NOLABELS=TRUE.
If you're concerned about people who use browsers that don't support the <EMBED> tag, don't worry; just use the <NOEMBED> tag to include alternative content. Follow the EMBED line with a line like this:
<NOEMBED> Content for non-capable browsers </NOEMBED>
For example, including a line that would launch the RealAudio helper application automatically if a browser doesn't support plug-ins would be nice, as shown here:
<EMBED SRC="sample1.rpm" WIDTH=300 HEIGHT=134> <NOEMBED><A SRC="sample1.ram"> Use the RealAudio helper app! </A></NOEMBED>
CAUTION: Don't accidentally use an .RPM file when you mean to use an .RAM file to launch the stand-alone RealAudio Player as a helper application! If you do, you'll get a full-screen instance of the RealAudio plug-in instead!
Here's what not to do:
<A HREF="sample1.rpm">Play sample clip full-screen!</A>
The HTML code in Listing 27.1 implements three instances of RealAudio clips on the same Web page. The results are shown in Figure 27.5.
<HTML> <HEAD> <TITLE>RealAudio EMBED Examples</TITLE> </HEAD> <BODY> <H1>Examples</H1> <P>Here are three examples of the RealAudio Plug-in.</P> <P>These examples require the RealAudio Player 2.0 or greater.</P> <H2>(1) Play and Stop buttons only</H2> <EMBED SRC="audio/jazz.rpm" ALIGN=BASELINE WIDTH=40 HEIGHT=20 CONTROLS=PlayButton CONSOLE="jazz2"> <EMBED SRC="audio/jazz.rpm" ALIGN=BASELINE WIDTH=40 HEIGHT=20 CONTROLS=StopButton CONSOLE="jazz2"> The "CONTROL" command specifies which attributes of the plug-in you want displayed.<P> The "CONSOLE" command allows the two elements to affect the same music clip. <H2>(2) Control Panel only</H2> <EMBED SRC="audio/tchai.rpm" WIDTH=200 HEIGHT=35 CONTROLS=ControlPanel> <H2>(3) Entire Plugin</H2> <EMBED SRC="audio/pace.rpm" WIDTH=300 HEIGHT=135 CONTROLS=All> </BODY> </HTML>
If the visitors to your Web site are prepared to handle ActiveX controls, you can use the <OBJECT> tag to install the proper control:
<OBJECT ID=RAOCX CLASSID="clsid:CFCDAA003-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT=140 WIDTH=312> <PARAM NAME="SRC" VALUE="pnm://audio.realaudio.com/file.ra"> <PARAM NAME="CONTROLS" VALUE="all"> </OBJECT>
his page uses the RealAudio plug-in three different ways.
The value of the parameters such as CONTROLS, CONSOLE, and AUTOSTART are identical to those used with the Navigator plug-in.
TIP: Set HEIGHT and WIDTH to 0 to make the ActiveX control invisible.
The RealAudio Server is available in two versions: the RealAudio Basic Server and the Real Server families. Both incarnations send RealAudio audio streams over a network (intranet or Internet) to users of the RealAudio Player (or Real Player). The Basic Server is intended for light duty, and typically runs on the same host as your Web server. The RealServer family is RealNetwork's high-end product; it is designed to support large commercial and intranet sites. Note, too, that there are some support and licensing restrictions on the Basic Server. Check the licensing agreement for details.
TIP: If your needs are modest, you might not need a RealAudio Server at all. RealNetworks supports a "pseudostreaming" protocol based on HTTP and TCP. To learn how to serve a streaming audio file directly from your Web server, see http://www.realaudio.com/help/content/httpstream.html. You may also want to read the white paper at http://www.real.com/help/content/http_vs_ra.html.
The RealAudio Basic Server runs on a 486 or Pentium system running Windows 95 or Windows NT, or on Macintosh OS 7.5.x or higher. It is also available on a variety of UNIX platforms. The Basic Server is started, stopped, and configured through a user-friendly graphical interface. In a typical installation, the server delivers two simultaneous audio streams. Each stream requires 10Kbits per second of network bandwidth, which means you'll need a 56Kbps or T1 leased line to use it effectively. It supports full-random access for each stream and generates a log file containing usage statistics and error information.
Generally, you can set up the Basic Server to work with any Web server that supports configurable MIME types. You can download the Basic Server directly from the Web. See http://www.real.com/server/basic/index.html/ for details.
You'll probably want to install the RealAudio Basic Server on the same computer that's running your Web server. You can run it on a separate machine, but because it takes up so little in the way of resources, you really don't need to run it this way. To install the server, all you have to do is double-click the server setup file icon. When installation is complete, the RealAudio Basic Server Control Panel will open and the Basic Server will be activated. Before setting up your RealAudio Web site, you will need to identify the file location where you want to store your audio and log files.
One task you must perform before either version of the RealAudio Server can deliver RealAudio content is to configure your Web server to recognize the MIME types listed in Table 27.3.
|Extension||MIME Type Definition|
The process for setting MIME types varies from Web server to Web server; check your server documentation for details on how to set MIME types for your particular server. But don't forget to do so. If you don't set these types, viewers will be prompted to save the file to disk.
RealNetworks distributes three packages based on their "RealSystem."
ON THE WEB: http://www.real.com/server/ Start on this page to learn about the range of RealNetworks servers available.
CAUTION: Streaming audio can require 10 to 20Kbps or higher per connection, depending on the codec you choose and the bandwidth negotiated. You can easily install a server that will saturate several 56Kbps leased lines. Talk to RealNetworks about your plans; you may need to budget for several T1s to support the load on your site.
NOTE: The Real Servers support Bandwidth Negotiation. This feature allows a RealAudio Player to select the best version of the audio clip automatically, based on the throughput of the available connection.
To use this feature, you must use the RealAudio Encoder to create two or more stream files. In the directory you have set up as your source for .RA files, for each sound you want to deliver you create a subdirectory that contains all versions of the encoded file. The 14.4 encoded file should be called 14_4.18, and the 28.8 file should be named 28_8.36. You should reference the subdirectory--which should be named to include the .RA extension--rather than a specific file in the URL listed in the associated .RAM or .RPM file. A utility called raconv, which is included with the RealAudio Server 3.0, automates this process. See http://www.real.com/help/server/server2.0/contman.html for full details.
You can configure the RealAudio Server to work with any Web server that supports configurable MIME types. It works with all popular servers, including Netscape Enterprise and Microsoft Internet Information Server.
The most advanced feature of the Real Server is its capability to synchronize RealAudio clips to serve as elements in a multimedia presentation. The process is straightforward but involves three distinct steps.
Synchronized multimedia "shows" should take place only on pages that include frames. One frame is reserved for the RealAudio plug-in with its associated controls, and at least one frame is needed to display the multimedia content. This design is necessary because loading a new page would otherwise replace the page containing the plug-in, which stops the plug-in from playing. By using frames, you keep the plug-in active.
First, build a text file listing the times that the frame content should change and the URLs that should be loaded at those times. The format is:
u starttime endtime URL
The starting u is required for each line. The starttime and endtime elements have the format dd:hh:mm:ss.t, where dd is days, hh is hours, mm is minutes, ss is seconds, and t is tenths of a second. (This same format is used for delayed play in .RAM files.) These times refer to the time in the clip at which the frame should begin and end playing. You must include the number of seconds; you can omit finer- or coarser-grained times as desired. URL is the URL of the frame to be displayed at the indicated time. You should have no blank lines between lines in the list. However, the input file can contain comment lines beginning with the # symbol. A real-world example might look like this:
u 00:00:10.0 00:00:59.9 http://www.RealAudio.com/ u 00:01:00.0 00:02:00.0 http://www.mysite.com/page2/
This input file tells the Player to send the Web browser to the RealAudio home page at 10 seconds into the audio clip. At one minute into the audio clip, the Web browser will display a page from www.mysite.com.
After you build this text file, you must compile it into a binary by using the cevents command-line tool supplied with the server. The syntax is:
cevents source.txt audiofilename.rae
The resulting .RAE file (which should have the same base name as the associated .RA audio file) is then placed in the same directory as the .RA audio file. This file is automatically located by the RealAudio Server when the listener opens the associated .RA file. The RealAudio Server streams audio and event information to the Player. As the event information is streamed to the RealAudio Player, the RealAudio Player then sends requests to the Web browser telling it when to update the page's content.
ON THE WEB: Detailed information on creating RealAudio Synchronized Multimedia files is available at http://www.real.com/reate/synchmm.html.
Netscape has targeted its SuiteSpot family of servers (which includes the Netscape Media Server) for intranet users. The media server can accommodate audio clips (after the manner of Real Systems' servers). It also supports live events. Because many live events will quickly outstrip even the 100-plus simultaneous connections that can be supported by high-end servers, Netscape recommends that live events be placed on the Net by using multicasting. Figure 27.6 shows the Media Server being configured for such an event.
Use multicasting to reduce bandwidth demands during a live feed.
In conventional Internet Protocol transmissions (known as unicasting), each packet has a designated destination. If two users connect to the same source, two connections are set up. Identical data is sent to each end user. Each connection consumes processor power and, more importantly, bandwidth.
A better approach is to assign a Class D (multicasting) address and port as the "destination" of each packet from the live feed. Then each user who wants to listen to the feed "tunes in" to that address and port. Because the server needs only one real-time connection, the load on the server and the network is modest, and the number of listeners is virtually unlimited.
TIP: If you're producing a live event for consumption inside your organization, set the packet Time-To-Live low so that the multicasted packets won't pass beyond your firewall.
Netscape uses the Internet standard Real-Time Streaming Protocol (RTSP) as the basis for communications between the Media Server and the Media Player. After you set up a Media Server and place content on it, the easiest way to add that content to a Web page is to use an rtsp:// URL.
NOTE:etscape worked with RealNetworks to develop the RTSP. You'll notice many similarities between the Netscape media products and RealNetworks' software.
As you do with RealNetworks' line of products, you add Netscape's streaming audio to a Web page by writing a metafile and then referencing the metafile in an <EMBED> tag. Netscape's version of the metafile is called .LAM, for Live Audio Metafile.
Also as you do with RealNetwork's products, you need to run a utility to encode your audio in streaming format (here called LiveAudio format). Netscape's utility is called the Media Converter. Not only will this converter build LiveAudio out of non-streaming formats, it will also write the .LAM file and the <EMBED> tag for you. A typical <EMBED> tag might read as follows:
<EMBED SRC="http://www.xyz.com/Media/test.lam" OPTIONS=TRUE PLAYBUTTON=TRUE STOPBUTTON=TRUE VOLUME=TRUE SEEK=TRUE HEIGHT=29 WIDTH=325 LOOP=TRUE AUTOSTART=TRUE> </EMBED>
Figure 27.7 shows the resulting instance of the Media Player plug-in.
If you specify OPTIONS=TRUE PLAYBUTTON=TRUE STOPBUTTON=TRUE VOLUME=TRUE SEEK=TRUE, you'll get this set of controls.
TIP: If you want to provide end users with a different set of controls than the ones built into the Media Player, you can use Netscape's LiveConnect technology and the Java language to build a different interface.
Xing Technology has built their streaming audio solution (as well as a streaming video solution) around the industry standard, MPEG, also known as ISO CD 11172. MPEG, developed by the Moving Pictures Experts Group, includes standards for highly compressed video as well as audio. The third part of the MPEG I standard, ISO CD 11172-3, addresses audio compression.
MPEG's audio standard is based on perceptual codecs, which take advantage of the fact that certain sounds cannot be detected by the human ear even when they are present in the signal. MPEG audio is defined in three layers; each layer offers higher performance (and increased complexity) than the one before it. Each layer is also compatible with the one before it; a layer-2 decoder can decode a bit stream encoded in layer-1.
Perceptual codecs can be tested only by live human evaluators. Table 27.4 shows the scale used in MPEG listening tests, in which human listeners compare the encoded sound with the original sound.
|5.0||Transparent (encoded signal is indistinguishable from the original)|
|4.0||Perceptible difference but not annoying|
Table 27.5 summarizes the quality and target bit rate for the three MPEG audio layers.
|Layer||Quality||Target Bit Rate|
|Layer-2||2.1 to 2.6||128Kbps|
|Layer-3||3.6 to 3.8||64Kbps|
The quality figures in this table are for bit rates of around 60 to 64Kbps--roughly comparable to a 56Kbps dial-up connection or a single B-channel ISDN line. At bit rates of 120Kbps, layer-2 and layer-3 performed about the same; listeners found it difficult to distinguish the encoded signals from the originals.
Use the XingMPEG Encoder to convert audio files such as .WAV and MPEG 2 audio files, as well as QuickTime and AVI movies, to the industry-standard MPEG format.
NOTE: The XingMPEG Encoder is optimized for Intel's MMX technology. If you want to convert files quickly, be sure to use an MMX-enhanced Pentium.
After you convert your files to MPEG audio format, use Xing's StreamWorks Server to make your files available to the Web. (You can use the same software to send MPEG video, as well.)
When an end user connects to your .XDM file, the user's browser will invoke the StreamWorks Player program, as shown in Figure 27.8.
Xing Technology's StreamWorks player can play audio or display video clips.
© Copyright, Macmillan Computer Publishing. All rights reserved.