Java Sound API: Soundbanks

Java Sound API

This page provides different soundbanks which you can download and use with Java Sound. Soundbanks are necessary for correct operation of the internal software synthesizer that ships with Java Sound. By default, the Windows version of the J2RE does not ship with a soundbank, so you need to manually install one to use Java Sound's MIDI engine. Java Sound has a fallback mechanism that uses a hardware MIDI port if no soundbank is available, but it prevents reliable and consistent MIDI playback, so installation of a soundbank is recommended for Java Sound.

Download

High quality soundbanks which can be used by the Java Sound engine.

  • minimal [0.35 MB]
    This is the smallest soundbank you can use, with only slightly less quality than the midsize soundbank. It is the default soundbank shipped with Java 2 SDK, Standard Edition, version 1.2.2 and above.
  • midsize [1.09 MB]
    This is the medium sized soundbank which gives you slightly better quality than the minimal soundbank. It shipped with Java 2 SDK, Standard Edition, version 1.2 and 1.2.1.
  • deluxe [4.92 MB]
    A mammoth soundbank with the best quality sound samples.

Installation Instructions

Go to the soundbank directory:

  • Solaris/Linux: If you installed the Java 2 SDK, change directories to <install-dir>/jre/lib/audio, otherwise change directories to <install-dir>/lib/audio.
    The <install-dir> should be where you installed your copy of the Java 2 SDK or RE.
  • Windows: With the Explorer, go to folder C:\Program Files\JavaSoft\JRE\<version>\lib\audio.
    C: is the drive of your Windows installation. Program Files may have another name if you have a non-english Windows version. <version> is the version of the J2SE or J2RE that you use.

If the audio directory does not exist, create it.

If you see a file with called soundbank.gm, then you already have a soundbank installed. You may still want to install a new soundbank to get higher quality.

Download the soundbank of your choice from the URLs above to this directory.

Unzip the soundbank using the unzip utility on your system

Java Sound automatically uses the highest-quality soundbank that it finds, so renaming to soundbank.gm is not necessary.

Windows: If you installed the J2SDK, go to folder <install-dir>\jre\lib\audio and copy the soundbank file in that folder, too.
<install-dir> is the folder where you installed the J2SE, e.g. C:\JDK1.3.1_01.
Note that double clicking a jar file usually invokes the J2RE, even if you have installed the J2SDK.

Exit all Java applications. At this point, when you start up a Java application or applet, it should use the new soundbank.

Information about Soundbanks

The Java Sound reference implementation uses the Beatnik Audio Engine to render MIDI notes. Soundbanks can be installed at runtime from Rich Media Files (RMF) which include embedded soundbanks.

As Java Sound is extensible, 3rd party plugins may become available to provide support for different soundbank file formats.

For some users, it is confusing to see that Java Sound is still able to play MIDI files or output MIDI sounds (i.e. with a MidiChannel instance) when there is no soundbank available. This is due to the fallback mechanism: Java Sound searches for soundbanks in different locations. On Windows, if it cannot find one, it will try to use a MIDI port: the MIDI Mapper. It is the default MIDI port on Windows (you can set it with the Sound applet in the control panel), and often it is set to a synthesizer (e.g. a hardware synthesizer on the soundcard, or a software synthesizer). In such a case, Java Sound will return null for a call to Synthesizer.getDefaultSoundbank(), because there is no soundbank that Java Sound has access to. Unfortunately, timing is quite unstable for the MIDI port and therefore it is recommended to use a soundbank. If you want to use MIDI ports (and e.g. a synthesizer connected to it), then you should not use the default MidiDevice, but use the hardware MIDI devices. Often, it is a good idea to let the user choose which MIDI device to use. Access to hardware MIDI ports is available since J2SE version 1.4.1. Currently, Java Sound's sequencer cannot make use of the hardware ports.. In the mean time, a third party implementation of Sequencer may help, e.g. the all-Java sequencer on tritonus.org.