    Contents    Previous    Next

#### Adding an Applet to a Page

# Performing Sounds

The AudioItem applet lets you put sound into an HTML page. By default, the sound file you specify plays once each time the page is visited or the user clicks the sound icon. If you specify a list of sounds to play, then the first sound is played the first time the page is visited (or icon clicked), the second sound is played the second time, and so on. After the AudioItem has played every sound in the list, it plays the last sound for all subsequent visits of the page (or clicks of the icon).

To put sound into an HTML page:

1. Create one or more sounds. Currently, they must be 8 bit µlaw, 8000Hz, one channel, Sun ".au" files. You can create these on a Sun workstation using the `audiotool` application. You can convert files from other sound formats using an audio format conversion program.
2. Put the sound files into a place where they can be published -- for example, in the same directory (folder) as the HTML page that will play them.
3. Add the sounds to the HTML page, using the `APP` HTML tag. Separate file names with a vertical bar ("|").

   For example, to play one sound every time the reader visits the page (or clicks the sound icon):

       <APP CLASS="AudioItem"
            SRC="doc:/demo/"
            SND="Hello.au">

If you want the last (or only) sound in the list to be played only once, then end the list with a vertical bar ("|").

The sounds this page plays (if you're using HotJava) were specified with the following:

      <APP CLASS="AudioItem"
           SRC="doc:/demo/"
           SND="Hello.au|Welcome.au">

    Contents    Previous    Next