Java Audio Tools

 

AudioTools.zip contains a collection of Java programs for manipulating sampled audio (e.g. WAV files and tones).

The examples use AudioTools.java which packages up a wide range of functions for sampled audio, falling into eight broad groups:

  1. playing/looping audio;
  2. loading/saving audio;
  3. recording;
  4. tone generation;
  5. wave functions for generating tones;
  6. audio drawing tools;
  7. audio information;
  8. audio array manipulation;

A lot of AudioTools.java is derived from StdAudio.java by Robert Sedgewick and Kevin Wayne, and AudioEffects.java at the Univ. of Montana. Over the years, I've also borrowed code from other sources, including JSresources.org and java2s.com.

Sedgewick and Wayne's clever idea is to manipulate sampled audio using only a 44,100 Hz (CD quality), 16-bit, monaural format, which means that a sample can be stored as an array of doubles. This makes it very easy to apply audio effects, such as volume adjustment, echoing, padding and cutting, and even reversal of the sample.

AudioTools.zip includes several examples:

There's also a JFreeChart-based program called ChartAudio.java, which can be attached to a play() call, and dynamically draws a time-series chart of the audio. It produces output such as:

[ChartAudio output]

Incidentally, AudioTools.java doesn't support MIDI processing, although that is part of Java sound. There's a lot of MIDI examples at JSresources.org, or you could look at Chapter 5 of my book Killer Game Programming in Java.

 

Download


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