The Java TM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search

Trail: Sound
Lesson: Sound

## Overview

> Java Sound provides a very high-quality 64-channel audio rendering and MIDI sound synthesis engine that
> - Enables consistent, reliable, high-quality audio on all Java platforms
> - Minimizes the impact of audio-rich web pages on computing resources
> - Reduces the need for high-cost sound cards by providing a software-only solution that requires only a digital-to-analog converter (DAC)
> - Supports a wide range of audio formats
> The new sound engine is integrated into the Java Virtual Machine as a core library.

### Using the Java Sound Engine

> JDK 1.2 enables you to create and play `AudioClips` from both applets and applications. The clips can be any of the following audio file formats:
> - AIFF
> - AU
> - WAV
> - MIDI (type 0 and type 1 files)
> - RMF
> The sound engine can handle 8- and 16-bit audio data at virtually any sample rate. In JDK 1.2 audio files are rendered at a sample rate of 22 kHz in 16-bit stereo. If the hardware doesn't support 16-bit data or stereo playback, 8-bit or mono audio is output.

> There's no need to worry about the impact of audio-rich Web pages on computing resources. The Java Sound engine minimizes the use of a system's CPU to process sound files. For example, a 24-voice MIDI file uses only 20 percent of the CPU on a Pentium 90 MHz system.

### Accessing the Java Sound Engine

> A full-featured Java Sound API is under development. This API will provide access to the underlying synthesis and rendering engine and will enable the creation of high-quality telephony and video conferencing applications. With the Java Sound API, professional musicians and sound designers will be able to develop new sounds that can be delivered over the Internet and used seamlessly with Java Sound.

### Java Sound and Java Media

> Java Sound is part of the Java Media family, which addresses the increasing demand for multimedia in the enterprise by providing a unified, nonproprietary, platform-neutral solution for incorporating time-based media, 2D fonts, graphics and images, speech input and output, 3D models, and telephony in Java programs. By providing standard players and integrating these supporting technologies, the Java Media APIs enable developers to produce and to distribute compelling, media-rich content.

> Java Sound provides uniform access to underlying platform sound capabilities, enabling Java programs to read and write sampled and synthesized audio data. Higher-level services, such as compression, decompression, synchronization, streaming, container read/write, and network transport, are handled by the Java Media Framework (JMF). JMF provides a simple, unified way for Java programs to synchronize and display time-based data, such as audio and video. Sun's implementation of JMF uses the Java Sound engine to render audio data.

> For more information about JMF and the other Java Media technologies, visit the Java Media & Communications pages on the Sun Website.

| Start of Tutorial > Start of Trail > Start of Lesson | Search