Java Sound Programmer Guide

Note: There are two ways to navigate this guide:

Introductory Material

Preface

For Whom This Guide Is Intended
What this Guide Describes
For More Information

Chapter: 1 Introduction to the Java Sound API

Design Goals
Who is the Java Sound API For?
How Does the Java Sound API Relate to Other Interfaces?
Packages
Sampled Audio
What Is Sampled Audio?
Audio Configurations
MIDI
What Is MIDI?
MIDI Configurations
Service Provider Interfaces

Part I: Sampled Audio

Chapter 2: Overview of the Sampled Package

Design Goals
A Focus on Data Transport
Buffered and Unbuffered Handling of Audio
The Essentials: Format, Mixer, and Line
What Is Formatted Audio Data?
What Is a Mixer?
What Is a Line?
Lines in an Audio-output Configuration
Lines in an Audio-input Configuration
The Line Interface Hierarchy

Chapter 3: Accessing Audio System Resources

The AudioSystem Class
Information Objects
Getting a Mixer
Getting a Line of a Desired Type
Getting a Line Directly from the AudioSystem
Getting a Line from a Mixer
Selecting Input and Output Ports
Permission to Use Audio Resources

Chapter 4: Playing Back Audio

Using a Clip
Setting Up the Clip for Playback
Starting and Stopping Playback
Using a SourceDataLine
Setting Up the SourceDataLine for Playback
Starting and Stopping Playback
Monitoring a Line's Status
Synchronizing Playback on Multiple Lines
Processing the Outgoing Audio

Chapter 5: Capturing Audio

Setting Up a TargetDataLine
Reading the Data from the TargetDataLine
Monitoring the Line's Status
Processing the Incoming Audio

Chapter 6: Processing Audio with Controls

Introduction to Controls
Getting a Line that Has the Desired Controls
Getting the Controls from the Line
Using a Control to Change the Audio Signal
Controlling a Line's Mute State
Changing a Line's Volume
Selecting among Various Reverberation Presets
Manipulating the Audio Data Directly

Chapter 7: Using Files and Format Converters

Reading Sound Files
Writing Sound Files
Converting File and Data Formats
Converting from One File Format to Another
Converting Audio between Different Data Formats
Learning What Conversions Are Available

Part II: MIDI

Chapter 8: Overview of the MIDI Package

A MIDI Refresher: Wires and Files
Streaming Data in the MIDI Wire Protocol
Sequenced Data in Standard MIDI Files
The Java Sound API's Representation of MIDI Data
MIDI Messages
MIDI Events
Sequences and Tracks
The Java Sound API's Representation of MIDI Devices
The MidiDevice Interface
Transmitters and Receivers
Sequencers
Synthesizers

Chapter 9: Accessing MIDI System Resources

The MidiSystem Class
Obtaining Default Devices
Learning What Devices Are Installed
Obtaining a Desired Device
Opening Devices

Chapter 10: Transmitting and Receiving MIDI Messages

Understanding Devices, Transmitters, and Receivers
Sending a Message to a Receiver without Using a Transmitter
Understanding Time Stamps
Time Stamps on Messages Sent to Devices
Connecting Transmitters to Receivers
Connecting to a Single Device
Connecting to More than One Device
Closing Connections

Chapter 11: Playing, Recording, and Editing MIDI Sequences

Introduction to Sequencers
When to Use a Sequencer
Understanding Sequence Data
Sequences and Tracks
MidiEvents and Ticks
Overview of Sequencer Methods
Obtaining a Sequencer
Loading a Sequence
Playing a Sequence
Recording and Saving Sequences
Editing a Sequence
Using Advanced Sequencer Features
Moving to an Arbitrary Position in the Sequence
Changing the Playback Speed
Muting or Soloing Individual
Tracks in the Sequence
Synchronizing with Other MIDI Devices
Specifying Special Event Listeners

Chapter 12: Synthesizing Sound

Understanding MIDI Synthesis
Instruments
Channels
Soundbanks and Patches
Voices
Managing Instruments and Soundbanks
Learning What Instruments Are Loaded
Loading Different Instruments
Unloading Instruments
Accessing Soundbank Resources
Querying the Synthesizer's Capabilities and Current State
Using Channels
Controlling the Synthesizer without
Using a Sequencer
Getting a Channel's Current State
Muting and Soloing a Channel
Permission to Play Synthesized Sound

Part III: Service Provider Interfaces

Chapter 13: Introduction to the Service Provider Interfaces

What Are Services?
How Services Work
How Providers Prepare New Services
How Users Install New Services

Chapter 14: Providing Sampled-Audio Services

Introduction
Providing Audio File-Writing Services
Providing Audio File-Reading Services
Providing Format-Conversion Services
Providing New Types of Mixers

Chapter 15: Providing MIDI Services

Introduction
Providing MIDI File-Writing Services
Providing MIDI File-Reading Services
Providing Particular MIDI Devices
Providing Soundbank File-Reading Services

Appendices

Appendix 1: Code Overview: AudioSystem.java

Last updated January 11, 2002