STUB FILES

Web designers may prefer to design their own console using the button elements from the standard console. To do this, a designer would have to place several EMBEDs on a page, and all of these EMBEDs would control the same sound.

Let's assume that a designer wants to create a page with seperate Play, Pause, Stop, and Volume controls. In this case, the designer would need four seperate EMBEDs in the HTML, all controlling the same sound file.

To do this, a designer wouldn't want to load the same sound four times (which would necessitate considerable additional download time for users), so LiveAudio is designed to accept and ignore "sound stubs." Sound stubs are files that are of negligible length (0K to 1K), and have a generic name like stub1.wav.

You can create a stub on the Windows platform by following these steps:

  1. In the accessories folder, select notepad.
  2. When notepad is loaded, hit the space button once.
  3. Select Save from the File menu.
  4. Title the file stub1.wav or something similar. The file extension must be a sound file type. Do not name the file stub1.txt because this will not work when attempting to activate LiveAudio.
You can create a stub on the Macintosh platform by following these steps:
  1. Open SimpleText (this should have come with your computer).
  2. SimpleText should create a new blank text file for you. If it doesn't, select New from the File menu.
  3. Select Save As... from the File menu.
  4. Title the file stub1.wav or something similar. The file extension must be a sound file type. Do not name the file stub1.txt because this will not work when attempting to activate LiveAudio.
Once you have created one stub, you can use the same file over and over again by duplicating the file and giving the duplicates new names (like stub2.wav).

To create a page with four LiveAudio elements (Play, Pause, Stop, and Volume) all controlling the same file, a designer will need to create three sound stubs and of course have one legitimate sound file (for a total of four EMBEDs).

Let's name these stub files stub1.wav, stub2.wav, and stub3.wav. Assume that the legitimate sound file is called mysound.wav. To create a page that has the four EMBEDs all controlling one sound, you should phrase your HTML like this:

        <HTML><HEAD></HEAD> <BODY>

        <EMBED       CONTROLS=PLAYBUTTON 
                        HEIGHT=22 
                        WIDTH=37 
                        SRC="mysound.wav" 
                        MASTERSOUND
                        NAME=LiveAudioGroup1>

        <EMBED       CONTROLS=PAUSEBUTTON 
                        HEIGHT=22 
                        WIDTH=37 
                        SRC="stub1.wav"
                        NAME=LiveAudioGroup1>

        <EMBED       CONTROLS=STOPBUTTON 
                        HEIGHT=22 
                        WIDTH=37 
                        SRC="stub2.wav"
                        NAME=LiveAudioGroup1>

        <EMBED       CONTROLS=VOLUMELEVER 
                        HEIGHT=20 
                        WIDTH=74 
                        SRC="stub3.wav"
                        NAME=LiveAudioGroup1>

        </BODY></HTML>
In the above example, the MASTERSOUND attribute (in the first EMBEDded element) tells LiveAudio which sound file is legitimate and which sound file it should ignore (because they are sound stubs).

Anytime you use the NAME attribute in a LiveAudio <EMBED>, you must also use a MASTERSOUND attribute. LiveAudio will play no sound when a name attribute exists without a corresponding MASTERSOUND attribute, even if that is the only EMBED with that name on the page.

The NAME attribute in the above example does two things: It logically groups the EMBEDs into one console, and it gives Navigator a named reference to the EMBED group (for use later in JavaScript with LiveConnect).

You can add many other items to an EMBED tag to enhance LiveAudio's performance. These tags include VOLUME, LOOP, and HIDDEN.

The VOLUME attribute is used to set the initial volume of a sound file (as a percentage from 0 to 100). For example, to start a sound with an initial volume of 65 percent, you would use the following EMBED.

        <EMBED       SRC="mysound.aif" 
                        HEIGHT=60 
                        WIDTH=144 
                        VOLUME=65%>
The LOOP attribute controls how many times a sound is heard once it is loaded onto a Web page. You can loop a defined number of times (i.e., one or two times), or you can loop continuously. To loop a particular sound file "forever," use the following example. (In reality, you can loop a sound file only as long as the page on which the sound is EMBEDded exists. When a user moves onto another page or when the sound-EMBEDded page is destroyed, the sound and sound controller is also destroyed.)

        <EMBED       SRC="mysound.aif" 
                        HEIGHT=60 
                        WIDTH=144 
                        LOOP=TRUE>
Or, to LOOP a sound file six times:
        <EMBED       SRC="mysound.aif" 
                        HEIGHT=60 
                        WIDTH=144 
                        LOOP=6>
You can also have a "hidden" sound file on a page. HIDDEN LiveAudio EMBEDs loads and plays, but does not have a graphically EMBEDded console for a Web user to control. This attribute can be useful for creating a background sound for a Web page (or a Web site). To create a sound file and have it play in HIDDEN mode, try the following:
        <EMBED       SRC="mysound.aif" 
                        HIDDEN=TRUE>
Notice that the above example does not have any HEIGHT or WIDTH information, nor does it include any extra parameters such as LOOP or VOLUME. You can, of course, loop and set volumes for HIDDEN sound files, but the above example illustrates the simplest possible HIDDEN sound EMBED. HEIGHT and WIDTH parameters are redundant and are not necessary when a HIDDEN plug-in is used.

Multimedia Index | LiveAudio | LiveVideo | Live3D | QuickTime


Corporate Sales: 415/937-2555; Personal Sales: 415/937-3777; Federal Sales: 415/937-3678
If you have any questions, please visit Customer Service.

Copyright © 1996 Netscape Communications Corporation