|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.tools.audio.Utils
Method Summary | |
static short |
bytesToShort(javax.sound.sampled.AudioFormat format,
byte[] byteArray)
Convert the bytes starting at the given offset to a signed short based upon the AudioFormat. |
static AudioData |
readAudioFile(java.lang.String filename)
Attempts to read an audio file using the Java Sound APIs. |
static AudioData |
readRawFile(java.lang.String filename)
Reads the given stream in as 16kHz 16-bit signed PCM big endian audio data and returns an audio clip. |
static short |
toShort(byte[] bytes,
boolean bigEndian)
Converts a byte array to a signed short value. |
static short[] |
toSignedPCM(javax.sound.sampled.AudioInputStream ais)
Turns the AudioInputStream into a 16bit, SIGNED_PCM, big endian audio stream that preserves the original sample rate of the AudioInputStream. |
static int |
toUnsignedShort(byte[] bytes,
boolean bigEndian)
Converts a byte array into an unsigned short. |
static void |
writeRawFile(AudioData audio,
java.lang.String filename)
Writes the given 16kHz 16-bit signed PCM audio clip to the given file as raw big endian data. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static short toShort(byte[] bytes, boolean bigEndian)
public static int toUnsignedShort(byte[] bytes, boolean bigEndian)
public static short bytesToShort(javax.sound.sampled.AudioFormat format, byte[] byteArray)
format
- the audio formatbyteArray
- the byte array
java.lang.ArrayIndexOutOfBoundsException
public static short[] toSignedPCM(javax.sound.sampled.AudioInputStream ais) throws java.io.IOException
java.io.IOException
public static AudioData readAudioFile(java.lang.String filename) throws java.io.IOException
filename
- the file containing audio data
java.io.IOException
public static AudioData readRawFile(java.lang.String filename) throws java.io.IOException
filename
- the file containing audio data
java.io.IOException
public static void writeRawFile(AudioData audio, java.lang.String filename) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |