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.
High quality soundbanks which can be used by the Java Sound engine.
Go to the soundbank directory:
<install-dir>/jre/lib/audio, otherwise change directories to
<install-dir>should be where you installed your copy of the Java 2 SDK or RE.
C:is the drive of your Windows installation.
Program Filesmay have another name if you have a non-english Windows version.
<version>is the version of the J2SE or J2RE that you use.
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.
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.
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.