javax.sound.sampled
Class AudioFormat

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.sampled.AudioFormat

public class AudioFormat
extends Object sample code for java.lang.Object definition code for java.lang.Object

AudioFormat is the class that specifies a particular arrangement of data in a sound stream. By examing the information stored in the audio format, you can discover how to interpret the bits in the binary sound data.

Every data line has an audio format associated with its data stream. The audio format of a source (playback) data line indicates what kind of data the data line expects to receive for output. For a target (capture) data line, the audio format specifies the kind of the data that can be read from the line. Sound files also have audio formats, of course. The AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat class encapsulates an AudioFormat in addition to other, file-specific information. Similarly, an AudioInputStream sample code for javax.sound.sampled.AudioInputStream definition code for javax.sound.sampled.AudioInputStream has an AudioFormat.

The AudioFormat class accommodates a number of common sound-file encoding techniques, including pulse-code modulation (PCM), mu-law encoding, and a-law encoding. These encoding techniques are predefined, but service providers can create new encoding types. The encoding that a specific format uses is named by its encoding field.

In addition to the encoding, the audio format includes other properties that further specify the exact arrangement of the data. These include the number of channels, sample rate, sample size, byte order, frame rate, and frame size. Sounds may have different numbers of audio channels: one for mono, two for stereo. The sample rate measures how many "snapshots" (samples) of the sound pressure are taken per second, per channel. (If the sound is stereo rather than mono, two samples are actually measured at each instant of time: one for the left channel, and another for the right channel; however, the sample rate still measures the number per channel, so the rate is the same regardless of the number of channels. This is the standard use of the term.) The sample size indicates how many bits are used to store each snapshot; 8 and 16 are typical values. For 16-bit samples (or any other sample size larger than a byte), byte order is important; the bytes in each sample are arranged in either the "little-endian" or "big-endian" style. For encodings like PCM, a frame consists of the set of samples for all channels at a given point in time, and so the size of a frame (in bytes) is always equal to the size of a sample (in bytes) times the number of channels. However, with some other sorts of encodings a frame can contain a bundle of compressed data for a whole series of samples, as well as additional, non-sample data. For such encodings, the sample rate and sample size refer to the data after it is decoded into PCM, and so they are completely different from the frame rate and frame size.

An AudioFormat object can include a set of properties. A property is a pair of key and value: the key is of type String, the associated property value is an arbitrary object. Properties specify additional format specifications, like the bit rate for compressed formats. Properties are mainly used as a means to transport additional information of the audio format to and from the service providers. Therefore, properties are ignored in the matches(AudioFormat) sample code for javax.sound.sampled.AudioFormat.matches(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioFormat.matches(javax.sound.sampled.AudioFormat) method. However, methods which rely on the installed service providers, like (AudioFormat, AudioFormat) isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat.Encoding, javax.sound.sampled.AudioFormat) may consider properties, depending on the respective service provider implementation.

The following table lists some common properties which service providers should use, if applicable:

Property key Value type Description
"bitrate" Integer sample code for java.lang.Integer definition code for java.lang.Integer average bit rate in bits per second
"vbr" Boolean sample code for java.lang.Boolean definition code for java.lang.Boolean true, if the file is encoded in variable bit rate (VBR)
"quality" Integer sample code for java.lang.Integer definition code for java.lang.Integer encoding/conversion quality, 1..100

Vendors of service providers (plugins) are encouraged to seek information about other already established properties in third party plugins, and follow the same conventions.

Since:
1.3
See Also:
DataLine.getFormat() sample code for javax.sound.sampled.DataLine.getFormat() definition code for javax.sound.sampled.DataLine.getFormat() , AudioInputStream.getFormat() sample code for javax.sound.sampled.AudioInputStream.getFormat() definition code for javax.sound.sampled.AudioInputStream.getFormat() , AudioFileFormat sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat , FormatConversionProvider sample code for javax.sound.sampled.spi.FormatConversionProvider definition code for javax.sound.sampled.spi.FormatConversionProvider

Nested Class Summary
static class AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding
          The Encoding class names the specific type of data representation used for an audio stream.
 
Field Summary
protected  boolean bigEndian sample code for javax.sound.sampled.AudioFormat.bigEndian definition code for javax.sound.sampled.AudioFormat.bigEndian
          Indicates whether the audio data is stored in big-endian or little-endian order.
protected  int channels sample code for javax.sound.sampled.AudioFormat.channels definition code for javax.sound.sampled.AudioFormat.channels
          The number of audio channels in this format (1 for mono, 2 for stereo).
protected  AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding encoding sample code for javax.sound.sampled.AudioFormat.encoding definition code for javax.sound.sampled.AudioFormat.encoding
          The audio encoding technique used by this format.
protected  float frameRate sample code for javax.sound.sampled.AudioFormat.frameRate definition code for javax.sound.sampled.AudioFormat.frameRate
          The number of frames played or recorded per second, for sounds that have this format.
protected  int frameSize sample code for javax.sound.sampled.AudioFormat.frameSize definition code for javax.sound.sampled.AudioFormat.frameSize
          The number of bytes in each frame of a sound that has this format.
protected  float sampleRate sample code for javax.sound.sampled.AudioFormat.sampleRate definition code for javax.sound.sampled.AudioFormat.sampleRate
          The number of samples played or recorded per second, for sounds that have this format.
protected  int sampleSizeInBits sample code for javax.sound.sampled.AudioFormat.sampleSizeInBits definition code for javax.sound.sampled.AudioFormat.sampleSizeInBits
          The number of bits in each sample of a sound that has this format.
 
Constructor Summary
AudioFormat sample code for javax.sound.sampled.AudioFormat.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean) definition code for javax.sound.sampled.AudioFormat.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean) (AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian)
          Constructs an AudioFormat with the given parameters.
AudioFormat sample code for javax.sound.sampled.AudioFormat.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean, java.util.Map) definition code for javax.sound.sampled.AudioFormat.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean, java.util.Map) (AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian, Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,Object sample code for java.lang.Object definition code for java.lang.Object > properties)
          Constructs an AudioFormat with the given parameters.
AudioFormat sample code for javax.sound.sampled.AudioFormat.AudioFormat(float, int, int, boolean, boolean) definition code for javax.sound.sampled.AudioFormat.AudioFormat(float, int, int, boolean, boolean) (float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian)
          Constructs an AudioFormat with a linear PCM encoding and the given parameters.
 
Method Summary
 int getChannels sample code for javax.sound.sampled.AudioFormat.getChannels() definition code for javax.sound.sampled.AudioFormat.getChannels() ()
          Obtains the number of channels.
 AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding getEncoding sample code for javax.sound.sampled.AudioFormat.getEncoding() definition code for javax.sound.sampled.AudioFormat.getEncoding() ()
          Obtains the type of encoding for sounds in this format.
 float getFrameRate sample code for javax.sound.sampled.AudioFormat.getFrameRate() definition code for javax.sound.sampled.AudioFormat.getFrameRate() ()
          Obtains the frame rate in frames per second.
 int getFrameSize sample code for javax.sound.sampled.AudioFormat.getFrameSize() definition code for javax.sound.sampled.AudioFormat.getFrameSize() ()
          Obtains the frame size in bytes.
 Object sample code for java.lang.Object definition code for java.lang.Object getProperty sample code for javax.sound.sampled.AudioFormat.getProperty(java.lang.String) definition code for javax.sound.sampled.AudioFormat.getProperty(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  key)
          Obtain the property value specified by the key.
 float getSampleRate sample code for javax.sound.sampled.AudioFormat.getSampleRate() definition code for javax.sound.sampled.AudioFormat.getSampleRate() ()
          Obtains the sample rate.
 int getSampleSizeInBits sample code for javax.sound.sampled.AudioFormat.getSampleSizeInBits() definition code for javax.sound.sampled.AudioFormat.getSampleSizeInBits() ()
          Obtains the size of a sample.
 boolean isBigEndian sample code for javax.sound.sampled.AudioFormat.isBigEndian() definition code for javax.sound.sampled.AudioFormat.isBigEndian() ()
          Indicates whether the audio data is stored in big-endian or little-endian byte order.
 boolean matches sample code for javax.sound.sampled.AudioFormat.matches(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioFormat.matches(javax.sound.sampled.AudioFormat) (AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format)
          Indicates whether this format matches the one specified.
 Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,Object sample code for java.lang.Object definition code for java.lang.Object > properties sample code for javax.sound.sampled.AudioFormat.properties() definition code for javax.sound.sampled.AudioFormat.properties() ()
          Obtain an unmodifiable map of properties.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.sound.sampled.AudioFormat.toString() definition code for javax.sound.sampled.AudioFormat.toString() ()
          Returns a string that describes the format, such as: "PCM SIGNED 22050 Hz 16 bit mono big-endian".
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

encoding sample code for javax.sound.sampled.AudioFormat.encoding

protected AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  encoding
The audio encoding technique used by this format.


sampleRate sample code for javax.sound.sampled.AudioFormat.sampleRate

protected float sampleRate
The number of samples played or recorded per second, for sounds that have this format.


sampleSizeInBits sample code for javax.sound.sampled.AudioFormat.sampleSizeInBits

protected int sampleSizeInBits
The number of bits in each sample of a sound that has this format.


channels sample code for javax.sound.sampled.AudioFormat.channels

protected int channels
The number of audio channels in this format (1 for mono, 2 for stereo).


frameSize sample code for javax.sound.sampled.AudioFormat.frameSize

protected int frameSize
The number of bytes in each frame of a sound that has this format.


frameRate sample code for javax.sound.sampled.AudioFormat.frameRate

protected float frameRate
The number of frames played or recorded per second, for sounds that have this format.


bigEndian sample code for javax.sound.sampled.AudioFormat.bigEndian

protected boolean bigEndian
Indicates whether the audio data is stored in big-endian or little-endian order.

Constructor Detail

AudioFormat sample code for javax.sound.sampled.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean) definition code for javax.sound.sampled.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean)

public AudioFormat(AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  encoding,
                   float sampleRate,
                   int sampleSizeInBits,
                   int channels,
                   int frameSize,
                   float frameRate,
                   boolean bigEndian)
Constructs an AudioFormat with the given parameters. The encoding specifies the convention used to represent the data. The other parameters are further explained in the class description sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat .

Parameters:
encoding - the audio encoding technique
sampleRate - the number of samples per second
sampleSizeInBits - the number of bits in each sample
channels - the number of channels (1 for mono, 2 for stereo, and so on)
frameSize - the number of bytes in each frame
frameRate - the number of frames per second
bigEndian - indicates whether the data for a single sample is stored in big-endian byte order (false means little-endian)

AudioFormat sample code for javax.sound.sampled.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean, java.util.Map<java.lang.String, java.lang.Object>) definition code for javax.sound.sampled.AudioFormat(javax.sound.sampled.AudioFormat.Encoding, float, int, int, int, float, boolean, java.util.Map<java.lang.String, java.lang.Object>)

public AudioFormat(AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  encoding,
                   float sampleRate,
                   int sampleSizeInBits,
                   int channels,
                   int frameSize,
                   float frameRate,
                   boolean bigEndian,
                   Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,Object sample code for java.lang.Object definition code for java.lang.Object > properties)
Constructs an AudioFormat with the given parameters. The encoding specifies the convention used to represent the data. The other parameters are further explained in the class description sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat .

Parameters:
encoding - the audio encoding technique
sampleRate - the number of samples per second
sampleSizeInBits - the number of bits in each sample
channels - the number of channels (1 for mono, 2 for stereo, and so on)
frameSize - the number of bytes in each frame
frameRate - the number of frames per second
bigEndian - indicates whether the data for a single sample is stored in big-endian byte order (false means little-endian)
properties - a Map<String,Object> object containing format properties
Since:
1.5

AudioFormat sample code for javax.sound.sampled.AudioFormat(float, int, int, boolean, boolean) definition code for javax.sound.sampled.AudioFormat(float, int, int, boolean, boolean)

public AudioFormat(float sampleRate,
                   int sampleSizeInBits,
                   int channels,
                   boolean signed,
                   boolean bigEndian)
Constructs an AudioFormat with a linear PCM encoding and the given parameters. The frame size is set to the number of bytes required to contain one sample from each channel, and the frame rate is set to the sample rate.

Parameters:
sampleRate - the number of samples per second
sampleSizeInBits - the number of bits in each sample
channels - the number of channels (1 for mono, 2 for stereo, and so on)
signed - indicates whether the data is signed or unsigned
bigEndian - indicates whether the data for a single sample is stored in big-endian byte order (false means little-endian)
Method Detail

getEncoding sample code for javax.sound.sampled.AudioFormat.getEncoding() definition code for javax.sound.sampled.AudioFormat.getEncoding()

public AudioFormat.Encoding sample code for javax.sound.sampled.AudioFormat.Encoding definition code for javax.sound.sampled.AudioFormat.Encoding  getEncoding()
Obtains the type of encoding for sounds in this format.

Returns:
the encoding type
See Also:
AudioFormat.Encoding.PCM_SIGNED sample code for javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED definition code for javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED , AudioFormat.Encoding.PCM_UNSIGNED sample code for javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED definition code for javax.sound.sampled.AudioFormat.Encoding.PCM_UNSIGNED , AudioFormat.Encoding.ULAW sample code for javax.sound.sampled.AudioFormat.Encoding.ULAW definition code for javax.sound.sampled.AudioFormat.Encoding.ULAW , AudioFormat.Encoding.ALAW sample code for javax.sound.sampled.AudioFormat.Encoding.ALAW definition code for javax.sound.sampled.AudioFormat.Encoding.ALAW

getSampleRate sample code for javax.sound.sampled.AudioFormat.getSampleRate() definition code for javax.sound.sampled.AudioFormat.getSampleRate()

public float getSampleRate()
Obtains the sample rate. For compressed formats, the return value is the sample rate of the uncompressed audio data. When this AudioFormat is used for queries (e.g. AudioSystem.isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) ) or capabilities (e.g. DataLine.Info.getFormats sample code for javax.sound.sampled.DataLine.Info.getFormats() definition code for javax.sound.sampled.DataLine.Info.getFormats() ), a sample rate of AudioSystem.NOT_SPECIFIED means that any sample rate is acceptable. AudioSystem.NOT_SPECIFIED is also returned when the sample rate is not defined for this audio format.

Returns:
the number of samples per second, or AudioSystem.NOT_SPECIFIED
See Also:
getFrameRate() sample code for javax.sound.sampled.AudioFormat.getFrameRate() definition code for javax.sound.sampled.AudioFormat.getFrameRate() , AudioSystem.NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED definition code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED

getSampleSizeInBits sample code for javax.sound.sampled.AudioFormat.getSampleSizeInBits() definition code for javax.sound.sampled.AudioFormat.getSampleSizeInBits()

public int getSampleSizeInBits()
Obtains the size of a sample. For compressed formats, the return value is the sample size of the uncompressed audio data. When this AudioFormat is used for queries (e.g. AudioSystem.isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) ) or capabilities (e.g. DataLine.Info.getFormats sample code for javax.sound.sampled.DataLine.Info.getFormats() definition code for javax.sound.sampled.DataLine.Info.getFormats() ), a sample size of AudioSystem.NOT_SPECIFIED means that any sample size is acceptable. AudioSystem.NOT_SPECIFIED is also returned when the sample size is not defined for this audio format.

Returns:
the number of bits in each sample, or AudioSystem.NOT_SPECIFIED
See Also:
getFrameSize() sample code for javax.sound.sampled.AudioFormat.getFrameSize() definition code for javax.sound.sampled.AudioFormat.getFrameSize() , AudioSystem.NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED definition code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED

getChannels sample code for javax.sound.sampled.AudioFormat.getChannels() definition code for javax.sound.sampled.AudioFormat.getChannels()

public int getChannels()
Obtains the number of channels. When this AudioFormat is used for queries (e.g. AudioSystem.isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) ) or capabilities (e.g. DataLine.Info.getFormats sample code for javax.sound.sampled.DataLine.Info.getFormats() definition code for javax.sound.sampled.DataLine.Info.getFormats() ), a return value of AudioSystem.NOT_SPECIFIED means that any (positive) number of channels is acceptable.

Returns:
The number of channels (1 for mono, 2 for stereo, etc.), or AudioSystem.NOT_SPECIFIED
See Also:
AudioSystem.NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED definition code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED

getFrameSize sample code for javax.sound.sampled.AudioFormat.getFrameSize() definition code for javax.sound.sampled.AudioFormat.getFrameSize()

public int getFrameSize()
Obtains the frame size in bytes. When this AudioFormat is used for queries (e.g. AudioSystem.isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) ) or capabilities (e.g. DataLine.Info.getFormats sample code for javax.sound.sampled.DataLine.Info.getFormats() definition code for javax.sound.sampled.DataLine.Info.getFormats() ), a frame size of AudioSystem.NOT_SPECIFIED means that any frame size is acceptable. AudioSystem.NOT_SPECIFIED is also returned when the frame size is not defined for this audio format.

Returns:
the number of bytes per frame, or AudioSystem.NOT_SPECIFIED
See Also:
getSampleSizeInBits() sample code for javax.sound.sampled.AudioFormat.getSampleSizeInBits() definition code for javax.sound.sampled.AudioFormat.getSampleSizeInBits() , AudioSystem.NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED definition code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED

getFrameRate sample code for javax.sound.sampled.AudioFormat.getFrameRate() definition code for javax.sound.sampled.AudioFormat.getFrameRate()

public float getFrameRate()
Obtains the frame rate in frames per second. When this AudioFormat is used for queries (e.g. AudioSystem.isConversionSupported sample code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioSystem.isConversionSupported(javax.sound.sampled.AudioFormat, javax.sound.sampled.AudioFormat) ) or capabilities (e.g. DataLine.Info.getFormats sample code for javax.sound.sampled.DataLine.Info.getFormats() definition code for javax.sound.sampled.DataLine.Info.getFormats() ), a frame rate of AudioSystem.NOT_SPECIFIED means that any frame rate is acceptable. AudioSystem.NOT_SPECIFIED is also returned when the frame rate is not defined for this audio format.

Returns:
the number of frames per second, or AudioSystem.NOT_SPECIFIED
See Also:
getSampleRate() sample code for javax.sound.sampled.AudioFormat.getSampleRate() definition code for javax.sound.sampled.AudioFormat.getSampleRate() , AudioSystem.NOT_SPECIFIED sample code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED definition code for javax.sound.sampled.AudioSystem.NOT_SPECIFIED

isBigEndian sample code for javax.sound.sampled.AudioFormat.isBigEndian() definition code for javax.sound.sampled.AudioFormat.isBigEndian()

public boolean isBigEndian()
Indicates whether the audio data is stored in big-endian or little-endian byte order. If the sample size is not more than one byte, the return value is irrelevant.

Returns:
true if the data is stored in big-endian byte order, false if little-endian

properties sample code for javax.sound.sampled.AudioFormat.properties() definition code for javax.sound.sampled.AudioFormat.properties()

public Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,Object sample code for java.lang.Object definition code for java.lang.Object > properties()
Obtain an unmodifiable map of properties. The concept of properties is further explained in the class description sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat .

Returns:
a Map<String,Object> object containing all properties. If no properties are recognized, an empty map is returned.
Since:
1.5
See Also:
getProperty(String) sample code for javax.sound.sampled.AudioFormat.getProperty(java.lang.String) definition code for javax.sound.sampled.AudioFormat.getProperty(java.lang.String)

getProperty sample code for javax.sound.sampled.AudioFormat.getProperty(java.lang.String) definition code for javax.sound.sampled.AudioFormat.getProperty(java.lang.String)

public Object sample code for java.lang.Object definition code for java.lang.Object  getProperty(String sample code for java.lang.String definition code for java.lang.String  key)
Obtain the property value specified by the key. The concept of properties is further explained in the class description sample code for javax.sound.sampled.AudioFileFormat definition code for javax.sound.sampled.AudioFileFormat .

If the specified property is not defined for a particular file format, this method returns null.

Parameters:
key - the key of the desired property
Returns:
the value of the property with the specified key, or null if the property does not exist.
Since:
1.5
See Also:
properties sample code for javax.sound.sampled.AudioFormat.properties definition code for javax.sound.sampled.AudioFormat.properties

matches sample code for javax.sound.sampled.AudioFormat.matches(javax.sound.sampled.AudioFormat) definition code for javax.sound.sampled.AudioFormat.matches(javax.sound.sampled.AudioFormat)

public boolean matches(AudioFormat sample code for javax.sound.sampled.AudioFormat definition code for javax.sound.sampled.AudioFormat  format)
Indicates whether this format matches the one specified. To match, two formats must have the same encoding, the same number of channels, and the same number of bits per sample and bytes per frame. The two formats must also have the same sample rate, unless the specified format has the sample rate value AudioSystem.NOT_SPECIFIED, which any sample rate will match. The frame rates must similarly be equal, unless the specified format has the frame rate value AudioSystem.NOT_SPECIFIED. The byte order (big-endian or little-endian) must match if the sample size is greater than one byte.

Parameters:
format - format to test for match
Returns:
true if this format matches the one specified, false otherwise.

toString sample code for javax.sound.sampled.AudioFormat.toString() definition code for javax.sound.sampled.AudioFormat.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string that describes the format, such as: "PCM SIGNED 22050 Hz 16 bit mono big-endian". The contents of the string may vary between implementations of Java Sound.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string that describes the format parameters