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 Synthesizers 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.
MidiSystem#getSynthesizer, Soundbank, Instrument, MidiChannel#programChange(int, int), Receiver, Transmitter, MidiDevice
| Modifier and Type | Method and Description |
|---|---|
| public Instrument[] | Returns: list of available instruments. If the synthesizer has no instruments coming with it, an array of length 0 is returned.Obtains a list of instruments that come with the synthesizer. |
| public MidiChannel[] | Returns: an array of theMidiChannel objects managed by this
Synthesizer. Some of the array elements may be
null.Obtains the set of MIDI channels controlled by this synthesizer. |
| public Soundbank | Returns: default soundbank, ornull if one does not existObtains the default soundbank for the synthesizer, if one exists. |
| public long | Returns: the worst-case delay, in microsecondsObtains the processing latency incurred by this synthesizer, expressed in microseconds. |
| public Instrument[] | Returns: a list of currently loaded instrumentsObtains a list of the instruments that are currently loaded onto this
|
| public int | Returns: the maximum number of simultaneous notesObtains the maximum number of notes that this synthesizer can sound simultaneously. |
| public VoiceStatus[] | Returns: an array ofVoiceStatus objects that supply information
about the corresponding synthesizer voicesObtains the current status of the voices produced by this synthesizer. |
| public boolean | Returns: true if the soundbank is supported, otherwise
falsesoundbank for which support is queried soundbank)Informs the caller whether this synthesizer is capable of loading instruments from the specified soundbank. |
| public boolean | Returns: true if the instruments are all successfully loaded (or
already had been), false if any instrument could not be
loaded (for example, if the Synthesizer had insufficient
memory)the soundbank)Soundbank whose are instruments are to be
loadedLoads onto the |
| public boolean | Returns: true if the instrument is successfully loaded (or already
had been), false if the instrument could not be loaded
(for example, if the synthesizer has insufficient memory to load
it)instrument to load instrument)Makes a particular instrument available for synthesis. |
| public boolean | Returns: true if the instruments are all successfully loaded (or
already had been), false if any instrument could not be
loaded (for example, if the Synthesizer had insufficient
memory)the soundbank, Patch[] Soundbank containing the instruments to
loadlist of patches for which instruments should be loaded patchList)Loads the instruments referenced by the specified patches, from the
specified |
| public boolean | Returns: true if the instrument successfully remapped,
false if feature is not implemented by synthesizerthe from, Instrument Instrument object to be replacedthe to)Instrument object to be used in place of the old
instrument, it should be loaded into the synthesizerRemaps an instrument. |
| public void | unloadAllInstruments(Soundbank
soundbank containing instruments to unload soundbank)Unloads all instruments contained in the specified |
| public void | |
| public void | unloadInstruments(Soundbank
soundbank containing instruments to unload soundbank, Patch[] list of patches for which instruments should be
unloaded patchList)Unloads the instruments referenced by the specified patches, from the MIDI sound bank specified. |
| getAvailableInstruments | back to summary |
|---|---|
| public Instrument[] getAvailableInstruments() Obtains a list of instruments that come with the synthesizer. These instruments might be built into the synthesizer, or they might be part of a default soundbank provided with the synthesizer, etc.
Note that you don't use this method to find out which instruments are
currently loaded onto the synthesizer; for that purpose, you use
| |
| getChannels | back to summary |
|---|---|
| public MidiChannel[] getChannels() Obtains the set of MIDI channels controlled by this synthesizer. Each
non-null element in the returned array is a
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
| |
| getDefaultSoundbank | back to summary |
|---|---|
| public Soundbank getDefaultSoundbank() Obtains the default soundbank for the synthesizer, if one exists. (Some synthesizers provide a default or built-in soundbank.) If a synthesizer doesn't have a default soundbank, instruments must be loaded explicitly from an external soundbank.
| |
| getLatency | back to summary |
|---|---|
| public long getLatency() Obtains the processing latency incurred by this synthesizer, expressed in microseconds. This latency measures the worst-case delay between the time a MIDI message is delivered to the synthesizer and the time that the synthesizer actually produces the corresponding result. 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.
| |
| getLoadedInstruments | back to summary |
|---|---|
| public Instrument[] getLoadedInstruments() Obtains a list of the instruments that are currently loaded onto this
| |
| getMaxPolyphony | back to summary |
|---|---|
| public int getMaxPolyphony() Obtains the maximum number of notes that this synthesizer can sound simultaneously.
| |
| getVoiceStatus | back to summary |
|---|---|
| public VoiceStatus[] getVoiceStatus() Obtains the current status of the voices produced by this synthesizer. If
this class of
| |
| isSoundbankSupported | back to summary |
|---|---|
| public boolean isSoundbankSupported(Soundbank soundbank) Informs the caller whether this synthesizer is capable of loading
instruments from the specified soundbank. If the soundbank is
unsupported, any attempts to load instruments from it will result in an
| |
| loadAllInstruments | back to summary |
|---|---|
| public boolean loadAllInstruments(Soundbank soundbank) Loads onto the
| |
| loadInstrument | back to summary |
|---|---|
| public boolean loadInstrument(Instrument instrument) Makes a particular instrument available for synthesis. This instrument is
loaded into the patch location specified by its
The instrument must be part of a soundbank that this
| |
| loadInstruments | back to summary |
|---|---|
| public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) Loads the instruments referenced by the specified patches, from the
specified
| |
| remapInstrument | back to summary |
|---|---|
| public boolean remapInstrument(Instrument from, Instrument to) Remaps an instrument. Instrument
To cancel the remapping reload instrument
| |
| unloadAllInstruments | back to summary |
|---|---|
| public void unloadAllInstruments(Soundbank soundbank) Unloads all instruments contained in the specified
| |
| unloadInstrument | back to summary |
|---|---|
| public void unloadInstrument(Instrument instrument) Unloads a particular instrument.
| |
| unloadInstruments | back to summary |
|---|---|
| public void unloadInstruments(Soundbank soundbank, Patch[] patchList) Unloads the instruments referenced by the specified patches, from the MIDI sound bank specified.
| |