Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In previous versions of JavaFX, there was no way to play low latency audio. This much-needed feature is now available in version 2.0 using the new AudioClip class. Audio clips are not suitable for large or lengthy sounds because the audio data associated with these sounds are decompressed and stored completely in memory. If you need to play a song or other lengthy audio file, you should use a Media object instead, which is discussed in the next section.
An AudioClip is ideal for playing short sounds in response to user actions in a game or other rich-media application. An AudioClip instance is constructed by passing a URI string as the only parameter to the constructor. This URI can point to a resource on the Internet, the local file system, or within the jar file by using the http:, file:, and jar: schemes, respectively. Once constructed, you can adjust several properties that affect the playback of the clip such as the volume, playback rate, panning, and balance. Calling its play method will begin playback of an AudioClip. You may call the play method repeatedly to begin multiple overlapping playbacks of a given clip.