| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsound.AudioFormatUtils
public class AudioFormatUtils
| Constructor Summary | |
|---|---|
| AudioFormatUtils() | |
| Method Summary | |
|---|---|
| static double[] | bytesToSamples(byte[] byteArray,
               int offset,
               int length,
               int bytesPerSample,
               boolean signedData)Converts a byte array into an array of samples (a double). | 
| static short[] | get16BitAudioData(javax.sound.sampled.AudioFormat format,
                  byte[] audioBytes) | 
| static javax.sound.sampled.AudioFormat | get44khzLinear16bitMonoSignedBigEndianFormat() | 
| static javax.sound.sampled.AudioFormat | get8000Linear16bitMonoSignedBigEndianFormat() | 
| static javax.sound.sampled.AudioFormat | get8khzMono8Format() | 
| static javax.sound.sampled.AudioFileFormat.Type | getAudioFileType() | 
| static javax.sound.sampled.AudioFormat | getCDLinearPcmFormat()Use 16 bit mono CD quality (44.1 khz sample rate with 16 bits per sample. | 
| static javax.sound.sampled.AudioFormat | getDefaultAudioFormat() | 
| static double[] | getDoubleData(javax.sound.sampled.AudioFormat format,
              byte[] audioBytes) | 
| static javax.sound.sampled.AudioFileFormat.Type | getSourceType() | 
| static boolean | isPcm(javax.sound.sampled.AudioFormat.Encoding encoding)Checks if the encoding is PCM. | 
| static double[] | littleEndianBytesToSamples(byte[] data,
                           int offset,
                           int length,
                           int bytesPerSample,
                           boolean signed)Converts a little-endian byte array into an array of samples (double). | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public AudioFormatUtils()
| Method Detail | 
|---|
public static javax.sound.sampled.AudioFormat getCDLinearPcmFormat()
public static javax.sound.sampled.AudioFormat getDefaultAudioFormat()
public static javax.sound.sampled.AudioFormat get8khzMono8Format()
public static javax.sound.sampled.AudioFormat get8000Linear16bitMonoSignedBigEndianFormat()
public static javax.sound.sampled.AudioFormat get44khzLinear16bitMonoSignedBigEndianFormat()
public static short[] get16BitAudioData(javax.sound.sampled.AudioFormat format,
                                        byte[] audioBytes)
public static double[] getDoubleData(javax.sound.sampled.AudioFormat format,
                                     byte[] audioBytes)
public static double[] bytesToSamples(byte[] byteArray,
                                      int offset,
                                      int length,
                                      int bytesPerSample,
                                      boolean signedData)
                               throws java.lang.ArrayIndexOutOfBoundsException
byteArray - a byte arrayoffset - which byte to start fromlength - how many bytes to convertbytesPerSample - the number of bytes per samplesignedData - whether the data is signed
null if byteArray is of zero
         length
java.lang.ArrayIndexOutOfBoundsException - thrown only if you go off the end of the array
public static double[] littleEndianBytesToSamples(byte[] data,
                                                  int offset,
                                                  int length,
                                                  int bytesPerSample,
                                                  boolean signed)
                                           throws java.lang.ArrayIndexOutOfBoundsException
data - a byte arrayoffset - which byte to start fromlength - how many bytes to convertbytesPerSample - the number of bytes per samplesigned - whether the data is signed
null if byteArray is of zero
         length
java.lang.ArrayIndexOutOfBoundsException - this should not happenpublic static javax.sound.sampled.AudioFileFormat.Type getAudioFileType()
public static boolean isPcm(javax.sound.sampled.AudioFormat.Encoding encoding)
encoding - query the audio format
public static javax.sound.sampled.AudioFileFormat.Type getSourceType()
| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||