Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of

Key information.

In the init method we request that the sound file is transferred from the same directory as where the HTML came from .

We get a valid reference to java.applet.AudioClip and the program continues immediately, whether the clip is going to be succesfully transferred or not ( ! ).

When the button is clicked, the file is played over and over again ....

, until the stop method is called, ....

when the user clicks the button for a second time,....

or leaves this HTML page or exits the browser, because in that case the applet's stop method is called.


One-time playing is done like this : ( ) ;


Audioclips can be played simultaneously : background music + effects !


With 1.1 applets can only play muLaw compressed, 8000Hz, 8-bits, mono .au files.

Since 1.2, you can play
.mid ( small files, excellent ! )


Since 1.2, to get an AudioClip in a STAND-ALONE application you code :
    someclip = Applet.newAudioClip ( url ) ;

( Stand-alone sound not possible before 1.2 )


It's not possible using core classes to determine a clip's length, so synchronizing clips is out of the question. For this kind of specialized work ( and VIDEO ! ) you can use the Java Media Framework, which is an optional library, so this has to be installed.