sound
Class AudioUtils
java.lang.Object
sound.AudioUtils
public class AudioUtils
- extends java.lang.Object
User: lyon
Date: Nov 4, 2006
Time: 9:59:21 AM
Copyright DocJava, Inc. 2005.
Field Summary |
static boolean |
DEBUG
|
Method Summary |
static void |
byteArrayToDoubleArray(double[][] doubleArray,
byte[] byteArray,
int bytesPerSample,
int channels)
|
static int |
calculateFrameSize(int nChannels,
int nSampleSizeInBits)
|
static void |
checkAudio()
|
static javax.sound.sampled.AudioInputStream |
convertEncoding(javax.sound.sampled.AudioFormat.Encoding targetEncoding,
javax.sound.sampled.AudioInputStream sourceStream)
|
static javax.sound.sampled.AudioInputStream |
convertSampleRate(float fSampleRate,
javax.sound.sampled.AudioInputStream sourceStream)
|
static void |
doubleArrayToByteArray(byte[] byteArray,
double[][] doubleArray,
int bytesPerSample,
int channels)
|
static byte |
encodeValue(float i)
|
static byte |
encodeValue(int i)
|
static javax.sound.sampled.AudioFileFormat.Type |
findTargetType(java.lang.String strExtension)
Trying to get an audio file type for the passed extension. |
static javax.sound.sampled.AudioFileFormat.Type[] |
getAudioFileTypes()
|
static javax.sound.sampled.AudioInputStream |
getSuitableAudioInputStream(javax.sound.sampled.AudioInputStream sourceAudioInputStream)
|
static javax.sound.sampled.AudioInputStream |
getSuitableAudioInputStream(javax.sound.sampled.Mixer mixer,
javax.sound.sampled.AudioInputStream sourceAudioInputStream)
|
static javax.sound.sampled.AudioInputStream |
getSuitableAudioInputStreamImpl(javax.sound.sampled.AudioInputStream sourceAudioInputStream,
javax.sound.sampled.AudioFormat targetFormat)
|
static javax.sound.sampled.AudioFormat |
getSuitableTargetFormat(javax.sound.sampled.AudioFormat sourceFormat)
|
static javax.sound.sampled.AudioFormat |
getSuitableTargetFormat(javax.sound.sampled.Mixer mixer,
javax.sound.sampled.AudioFormat sourceFormat)
|
static javax.sound.sampled.AudioFormat |
getSuitableTargetFormatImpl(java.util.Iterator possibleTargetFormats,
javax.sound.sampled.AudioFormat sourceFormat)
|
static java.util.Iterator |
getSupportedSourceDataLineFormats()
|
static java.util.Iterator |
getSupportedSourceDataLineFormats(javax.sound.sampled.Mixer mixer)
|
static java.util.Iterator |
getSupportedSourceDataLineFormatsImpl(javax.sound.sampled.Line.Info[] aLineInfos)
|
static int |
getValue(byte b)
If there is one byte per sample, get the linear value. |
static void |
main(java.lang.String[] args)
|
static void |
printSupportedTargetFileTypes()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEBUG
public static final boolean DEBUG
- See Also:
- Constant Field Values
AudioUtils
public AudioUtils()
main
public static void main(java.lang.String[] args)
checkAudio
public static void checkAudio()
getAudioFileTypes
public static javax.sound.sampled.AudioFileFormat.Type[] getAudioFileTypes()
printSupportedTargetFileTypes
public static void printSupportedTargetFileTypes()
findTargetType
public static javax.sound.sampled.AudioFileFormat.Type findTargetType(java.lang.String strExtension)
- Trying to get an audio file type for the passed extension.
This works by examining all available file types. For each
type, if the extension this type promisses to handle matches
the extension we are trying to find a type for, this type is
returned.
If no appropriate type is found, null is returned.
getSupportedSourceDataLineFormats
public static java.util.Iterator getSupportedSourceDataLineFormats(javax.sound.sampled.Mixer mixer)
getSupportedSourceDataLineFormats
public static java.util.Iterator getSupportedSourceDataLineFormats()
calculateFrameSize
public static int calculateFrameSize(int nChannels,
int nSampleSizeInBits)
convertEncoding
public static javax.sound.sampled.AudioInputStream convertEncoding(javax.sound.sampled.AudioFormat.Encoding targetEncoding,
javax.sound.sampled.AudioInputStream sourceStream)
doubleArrayToByteArray
public static void doubleArrayToByteArray(byte[] byteArray,
double[][] doubleArray,
int bytesPerSample,
int channels)
byteArrayToDoubleArray
public static void byteArrayToDoubleArray(double[][] doubleArray,
byte[] byteArray,
int bytesPerSample,
int channels)
convertSampleRate
public static javax.sound.sampled.AudioInputStream convertSampleRate(float fSampleRate,
javax.sound.sampled.AudioInputStream sourceStream)
getSupportedSourceDataLineFormatsImpl
public static java.util.Iterator getSupportedSourceDataLineFormatsImpl(javax.sound.sampled.Line.Info[] aLineInfos)
getSuitableTargetFormat
public static javax.sound.sampled.AudioFormat getSuitableTargetFormat(javax.sound.sampled.AudioFormat sourceFormat)
getSuitableTargetFormat
public static javax.sound.sampled.AudioFormat getSuitableTargetFormat(javax.sound.sampled.Mixer mixer,
javax.sound.sampled.AudioFormat sourceFormat)
getSuitableTargetFormatImpl
public static javax.sound.sampled.AudioFormat getSuitableTargetFormatImpl(java.util.Iterator possibleTargetFormats,
javax.sound.sampled.AudioFormat sourceFormat)
getSuitableAudioInputStream
public static javax.sound.sampled.AudioInputStream getSuitableAudioInputStream(javax.sound.sampled.AudioInputStream sourceAudioInputStream)
getSuitableAudioInputStream
public static javax.sound.sampled.AudioInputStream getSuitableAudioInputStream(javax.sound.sampled.Mixer mixer,
javax.sound.sampled.AudioInputStream sourceAudioInputStream)
getSuitableAudioInputStreamImpl
public static javax.sound.sampled.AudioInputStream getSuitableAudioInputStreamImpl(javax.sound.sampled.AudioInputStream sourceAudioInputStream,
javax.sound.sampled.AudioFormat targetFormat)
getValue
public static int getValue(byte b)
- If there is one byte per sample, get the linear value.
- Parameters:
b
- the twos complement byte
- Returns:
- the linear value.
encodeValue
public static byte encodeValue(float i)
encodeValue
public static byte encodeValue(int i)