Package | Description |
---|---|
javax.sound.sampled |
Provides interfaces and classes for capture, processing, and playback of sampled audio data.
|
javax.sound.sampled.spi |
Supplies abstract classes for service providers to subclass when
offering new audio devices, sound file readers and writers, or audio format converters.
|
Modifier and Type | Field and Description |
---|---|
protected AudioFormat |
AudioInputStream.format
The format of the audio data contained in the stream.
|
Modifier and Type | Method and Description |
---|---|
AudioFormat |
DataLine.getFormat()
Obtains the current format (encoding, sample rate, number of channels,
etc.) of the data line's audio data.
|
AudioFormat |
AudioFileFormat.getFormat()
Obtains the format of the audio data contained in the audio file.
|
AudioFormat |
AudioInputStream.getFormat()
Obtains the audio format of the sound data in this audio input stream.
|
AudioFormat[] |
DataLine.Info.getFormats()
Obtains a set of audio formats supported by the data line.
|
static AudioFormat[] |
AudioSystem.getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
Obtains the formats that have a particular encoding and that the system can
obtain from a stream of the specified format using the set of
installed format converters.
|
Modifier and Type | Method and Description |
---|---|
static AudioInputStream |
AudioSystem.getAudioInputStream(AudioFormat targetFormat,
AudioInputStream sourceStream)
Obtains an audio input stream of the indicated format, by converting the
provided audio input stream.
|
static SourceDataLine |
AudioSystem.getSourceDataLine(AudioFormat format)
Obtains a source data line that can be used for playing back
audio data in the format specified by the
AudioFormat object. |
static SourceDataLine |
AudioSystem.getSourceDataLine(AudioFormat format,
Mixer.Info mixerinfo)
Obtains a source data line that can be used for playing back
audio data in the format specified by the
AudioFormat object, provided by the mixer
specified by the Mixer.Info object. |
static TargetDataLine |
AudioSystem.getTargetDataLine(AudioFormat format)
Obtains a target data line that can be used for recording
audio data in the format specified by the
AudioFormat object. |
static TargetDataLine |
AudioSystem.getTargetDataLine(AudioFormat format,
Mixer.Info mixerinfo)
Obtains a target data line that can be used for recording
audio data in the format specified by the
AudioFormat object, provided by the mixer
specified by the Mixer.Info object. |
static AudioFormat.Encoding[] |
AudioSystem.getTargetEncodings(AudioFormat sourceFormat)
Obtains the encodings that the system can obtain from an
audio input stream with the specified format using the set
of installed format converters.
|
static AudioFormat[] |
AudioSystem.getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
Obtains the formats that have a particular encoding and that the system can
obtain from a stream of the specified format using the set of
installed format converters.
|
static boolean |
AudioSystem.isConversionSupported(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
Indicates whether an audio input stream of the specified encoding
can be obtained from an audio input stream that has the specified
format.
|
static boolean |
AudioSystem.isConversionSupported(AudioFormat targetFormat,
AudioFormat sourceFormat)
Indicates whether an audio input stream of a specified format
can be obtained from an audio input stream of another specified format.
|
boolean |
DataLine.Info.isFormatSupported(AudioFormat format)
Indicates whether this data line supports a particular audio format.
|
boolean |
AudioFormat.matches(AudioFormat format)
Indicates whether this format matches the one specified.
|
void |
SourceDataLine.open(AudioFormat format)
Opens the line with the specified format, causing the line to acquire any
required system resources and become operational.
|
void |
TargetDataLine.open(AudioFormat format)
Opens the line with the specified format, causing the line to acquire any
required system resources and become operational.
|
void |
Clip.open(AudioFormat format,
byte[] data,
int offset,
int bufferSize)
Opens the clip, meaning that it should acquire any required
system resources and become operational.
|
void |
SourceDataLine.open(AudioFormat format,
int bufferSize)
Opens the line with the specified format and suggested buffer size,
causing the line to acquire any required
system resources and become operational.
|
void |
TargetDataLine.open(AudioFormat format,
int bufferSize)
Opens the line with the specified format and requested buffer size,
causing the line to acquire any required system resources and become
operational.
|
Constructor and Description |
---|
AudioFileFormat(AudioFileFormat.Type type,
AudioFormat format,
int frameLength)
Constructs an audio file format object.
|
AudioFileFormat(AudioFileFormat.Type type,
AudioFormat format,
int frameLength,
Map<String,Object> properties)
Construct an audio file format object with a set of
defined properties.
|
AudioFileFormat(AudioFileFormat.Type type,
int byteLength,
AudioFormat format,
int frameLength)
Constructs an audio file format object.
|
AudioInputStream(InputStream stream,
AudioFormat format,
long length)
Constructs an audio input stream that has the requested format and length in sample frames,
using audio data from the specified input stream.
|
Info(Class<?> lineClass,
AudioFormat format)
Constructs a data line's info object from the specified information,
which includes a single audio format.
|
Info(Class<?> lineClass,
AudioFormat[] formats,
int minBufferSize,
int maxBufferSize)
Constructs a data line's info object from the specified information,
which includes a set of supported audio formats and a range for the buffer size.
|
Info(Class<?> lineClass,
AudioFormat format,
int bufferSize)
Constructs a data line's info object from the specified information,
which includes a single audio format and a desired buffer size.
|
Modifier and Type | Method and Description |
---|---|
abstract AudioFormat[] |
FormatConversionProvider.getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
Obtains the set of target formats with the encoding specified
supported by the format converter
If no target formats with the specified encoding are supported
for this source format, an array of length 0 is returned.
|
Modifier and Type | Method and Description |
---|---|
abstract AudioInputStream |
FormatConversionProvider.getAudioInputStream(AudioFormat targetFormat,
AudioInputStream sourceStream)
Obtains an audio input stream with the specified format from the given audio
input stream.
|
abstract AudioFormat.Encoding[] |
FormatConversionProvider.getTargetEncodings(AudioFormat sourceFormat)
Obtains the set of target format encodings supported by the format converter
given a particular source format.
|
abstract AudioFormat[] |
FormatConversionProvider.getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
Obtains the set of target formats with the encoding specified
supported by the format converter
If no target formats with the specified encoding are supported
for this source format, an array of length 0 is returned.
|
boolean |
FormatConversionProvider.isConversionSupported(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
Indicates whether the format converter supports conversion to a particular encoding
from a particular format.
|
boolean |
FormatConversionProvider.isConversionSupported(AudioFormat targetFormat,
AudioFormat sourceFormat)
Indicates whether the format converter supports conversion to one
particular format from another.
|
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.