APIdia Launch Partner
Top Description Methods
com.sun.media.sound

public Interface AudioSynthesizer

extends Synthesizer
Known Direct Implementers
com.sun.media.sound.SoftSynthesizer
Imports
java.util.Map, javax.sound.midi.MidiSystem, .MidiUnavailableException, .Synthesizer, javax.sound.sampled.AudioFormat, .AudioInputStream, .SourceDataLine

AudioSynthesizer is a Synthesizer which renders it's output audio into SourceDataLine or AudioInputStream.
Author
Karl Helgason
See Also
MidiSystem#getSynthesizer, Synthesizer

Method Summary

Modifier and TypeMethod and Description
public AudioFormat

Returns:

current audio data format
getFormat
()

Obtains the current format (encoding, sample rate, number of channels, etc.) of the synthesizer audio data.

public AudioSynthesizerPropertyInfo[]

Returns:

an array of AudioSynthesizerPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.
getPropertyInfo
(Map<String, Object>
a proposed list of tag/value pairs that will be sent on open.
info
)

Gets information about the possible properties for the synthesizer.

public void
open(SourceDataLine
which AudioSynthesizer writes output audio into. If line is null, then line from system default mixer is used.
line
,
Map<String, Object>
a Map<String,Object> object containing properties for additional configuration supported by synthesizer. If info is null then default settings are used.
info
)

Opens the synthesizer and starts rendering audio into SourceDataLine.

public AudioInputStream
openStream(AudioFormat
specifies the AudioFormat used in returned AudioInputStream.
targetFormat
,
Map<String, Object>
a Map<String,Object> object containing properties for additional configuration supported by synthesizer. If info is null then default settings are used.
info
)

Opens the synthesizer and renders audio into returned AudioInputStream.

Inherited from javax.sound.midi.Synthesizer:
getAvailableInstrumentsgetChannelsgetDefaultSoundbankgetLatencygetLoadedInstrumentsgetMaxPolyphonygetVoiceStatusisSoundbankSupportedloadAllInstrumentsloadInstrumentloadInstrumentsremapInstrumentunloadAllInstrumentsunloadInstrumentunloadInstruments

Method Detail

getFormatback to summary
public AudioFormat getFormat()

Obtains the current format (encoding, sample rate, number of channels, etc.) of the synthesizer audio data.

If the synthesizer is not open and has never been opened, it returns the default format.

Returns:AudioFormat

current audio data format

See Also
AudioFormat
getPropertyInfoback to summary
public AudioSynthesizerPropertyInfo[] getPropertyInfo(Map<String, Object> info)

Gets information about the possible properties for the synthesizer.

Parameters
info:Map<String, Object>

a proposed list of tag/value pairs that will be sent on open.

Returns:AudioSynthesizerPropertyInfo[]

an array of AudioSynthesizerPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.

openback to summary
public void open(SourceDataLine line, Map<String, Object> info) throws MidiUnavailableException

Opens the synthesizer and starts rendering audio into SourceDataLine.

An application opening a synthesizer explicitly with this call has to close the synthesizer by calling close. This is necessary to release system resources and allow applications to exit cleanly.

Note that some synthesizers, once closed, cannot be reopened. Attempts to reopen such a synthesizer will always result in a MidiUnavailableException.

Parameters
line:SourceDataLine

which AudioSynthesizer writes output audio into. If line is null, then line from system default mixer is used.

info:Map<String, Object>

a Map<String,Object> object containing properties for additional configuration supported by synthesizer. If info is null then default settings are used.

Exceptions
MidiUnavailableException:
thrown if the synthesizer cannot be opened due to resource restrictions.
See Also
close, isOpen
openStreamback to summary
public AudioInputStream openStream(AudioFormat targetFormat, Map<String, Object> info) throws MidiUnavailableException

Opens the synthesizer and renders audio into returned AudioInputStream.

An application opening a synthesizer explicitly with this call has to close the synthesizer by calling close. This is necessary to release system resources and allow applications to exit cleanly.

Note that some synthesizers, once closed, cannot be reopened. Attempts to reopen such a synthesizer will always result in a MidiUnavailableException.

Parameters
targetFormat:AudioFormat

specifies the AudioFormat used in returned AudioInputStream.

info:Map<String, Object>

a Map<String,Object> object containing properties for additional configuration supported by synthesizer. If info is null then default settings are used.

Exceptions
MidiUnavailableException:
thrown if the synthesizer cannot be opened due to resource restrictions.
See Also
close, isOpen