edu.cmu.sphinx.tools.audio
Class RawReader

java.lang.Object
  extended byedu.cmu.sphinx.tools.audio.RawReader

public class RawReader
extends java.lang.Object

Reads a raw audio file (i.e., a file that is just plain raw samples and nothing else) and converts it to signed data.


Constructor Summary
RawReader()
           
 
Method Summary
static short[] readAudioData(java.io.InputStream audioStream, javax.sound.sampled.AudioFormat audioFormat)
          Reads raw bytes from the given audioStream and returns big endian signed samples based on the audioFormat.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawReader

public RawReader()
Method Detail

readAudioData

public static short[] readAudioData(java.io.InputStream audioStream,
                                    javax.sound.sampled.AudioFormat audioFormat)
                             throws java.io.IOException
Reads raw bytes from the given audioStream and returns big endian signed samples based on the audioFormat. Only PCM_SIGNED or PCM_UNSIGNED encodings are allowed.

Parameters:
audioStream - the stream containing the raw bytes
audioFormat - a hint of what to expect from the stream
Returns:
big endian signed samples, one sample per array element
Throws:
java.io.IOException