[MIDI PIC] Chapters 7-10.   Sound, Audio Effects, and Music Synthesis


[ This topic is discussed over 4 chapters in the book. ]

We start by discussing the simple Applet play() method and AudioClip class, available since the early days of Java. However, most of this chapter is about the Java Sound API, introduced in J2SE 1.3, which supports the recording, playback, and synthesis of sampled audio and MIDI sequences.

An overview of the Sound API is illustrated with small examples showing the playback of clips, buffered audio, and MIDI sequences. This leads into a larger application, LoadersTests, which demonstrates our ClipsLoader and MidisLoader classes for loading, playing, pausing, resuming, stopping, and looping clips and sequences. These loader classes will be used in later applications when audio is required.

One of the key advantages of the Sound API over AudioClips, is the ability for a programmer to delve into the low-level details of audio files, and affect (to some degree) audio devices (e.g. the mixer, sequencer, or synthesizer). This permits a variety of audio effects to be applied, and we consider clip and MIDI channel controllers, sample byte array manipulation, and the modification of MIDI messages.

The synthesis of new audio during a game's execution can be useful. We look at how to generate tone sequences for sampled audio, and create sequences at run time. We describe tools/APIs that can help.

The Sound API is compared to the Java Media Framework (JMF), and the recently introduced JOAL, a Java binding to OpenGL's music API.

One large topic missing from this chapter is audio capture, which seems less necessary for games. Good Web resources on this topic (and others related to Java Sound) are listed at the end.




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page