Synthesizer
generates sound. This usually happens when one of
the Synthesizer
's MidiChannel
objects receives a
noteOn
message, either
directly or via the Synthesizer
object.
Many Synthesizer
s support Receivers
, through which
MIDI events can be delivered to the Synthesizer
.
In such cases, the Synthesizer
typically responds by sending
a corresponding message to the appropriate MidiChannel
, or by
processing the event itself if the event isn't one of the MIDI channel
messages.
The Synthesizer
interface includes methods for loading and
unloading instruments from soundbanks. An instrument is a specification for synthesizing a
certain type of sound, whether that sound emulates a traditional instrument or is
some kind of sound effect or other imaginary sound. A soundbank is a collection of instruments, organized
by bank and program number (via the instrument's Patch
object).
Different Synthesizer
classes might implement different sound-synthesis
techniques, meaning that some instruments and not others might be compatible with a
given synthesizer.
Also, synthesizers may have a limited amount of memory for instruments, meaning
that not every soundbank and instrument can be used by every synthesizer, even if
the synthesis technique is compatible.
To see whether the instruments from
a certain soundbank can be played by a given synthesizer, invoke the
isSoundbankSupported
method of
Synthesizer
.
"Loading" an instrument means that that instrument becomes available for
synthesizing notes. The instrument is loaded into the bank and
program location specified by its Patch
object. Loading does
not necessarily mean that subsequently played notes will immediately have
the sound of this newly loaded instrument. For the instrument to play notes,
one of the synthesizer's MidiChannel
objects must receive (or have received)
a program-change message that causes that particular instrument's
bank and program number to be selected.
All Receiver
and Transmitter
instances
open from this device are closed. This includes instances retrieved
via MidiSystem
.
Note that you don't use this method to find out which instruments are
currently loaded onto the synthesizer; for that purpose, you use
getLoadedInstruments()
.
Nor does the method indicate all the instruments that can be loaded onto
the synthesizer; it only indicates the subset that come with the synthesizer.
To learn whether another instrument can be loaded, you can invoke
isSoundbankSupported()
, and if the instrument's
Soundbank
is supported, you can try loading the instrument.
MidiChannel
that
receives the MIDI messages sent on that channel number.
The MIDI 1.0 specification provides for 16 channels, so this
method returns an array of at least 16 elements. However, if this synthesizer
doesn't make use of all 16 channels, some of the elements of the array
might be null
, so you should check each element
before using it.
Strings
containing its name, vendor, and description.Although the latency is expressed in microseconds, a synthesizer's actual measured delay may vary over a wider range than this resolution suggests. For example, a synthesizer might have a worst-case delay of a few milliseconds or more.
Synthesizer
.Obtaining a Receiver
with this method does not
open the device. To be able to use the device, it has to be
opened explicitly by calling #open
. Also, closing the
Receiver
does not close the device. It has to be
closed explicitly by calling #close
.
Obtaining a Transmitter
with this method does not
open the device. To be able to use the device, it has to be
opened explicitly by calling #open
. Also, closing the
Transmitter
does not close the device. It has to be
closed explicitly by calling #close
.
Synthesizer
does not provide voice
information, the returned array will always be of length 0. Otherwise,
its length is always equal to the total number of voices, as returned by
getMaxPolyphony()
. (See the VoiceStatus
class
description for an explanation of synthesizer voices.)IllegalArgumentException
.Synthesizer
all instruments contained
in the specified Soundbank
.Patch
object, so that if a program-change message is
received (or has been received) that causes that patch to be selected,
subsequent notes will be played using the sound of
instrument
. If the specified instrument is already loaded,
this method does nothing and returns true
.
The instrument must be part of a soundbank
that this Synthesizer
supports. (To make sure, you can use
the getSoundbank
method of Instrument
and the
isSoundbankSupported
method of Synthesizer
.)
Soundbank
. Each of the Patch
objects
indicates a bank and program number; the Instrument
that
has the matching Patch
is loaded into that bank and program
location.An application opening a device explicitly with this call has to close the device by calling #close . This is necessary to release system resources and allow applications to exit cleanly.
Note that some devices, once closed, cannot be reopened. Attempts to reopen such a device will always result in a MidiUnavailableException.
to
takes the
place of instrument from
.
For example, if from
was located at bank number 2,
program number 11, remapping causes
that bank and program location to be occupied instead by
to
. Instrument from
is unloaded.Soundbank
.