edu.cmu.sphinx.frontend.util
Class Utterance

java.lang.Object
  extended byedu.cmu.sphinx.frontend.util.Utterance

public class Utterance
extends java.lang.Object

Represents the complete audio data of an utterance.


Constructor Summary
Utterance(java.lang.String name, javax.sound.sampled.AudioFormat format)
          Constructs a default Utterance object.
 
Method Summary
 void add(byte[] audio)
          Adds an audio frame into this Utterance.
 byte[] getAudio()
          Returns the complete audio stream of this utterance.
 javax.sound.sampled.AudioFormat getAudioFormat()
          Returns the audio format of this Utterance.
 float getAudioTime()
          Returns the amount of time (in seconds) this Utterance lasts.
 java.lang.String getName()
          Returns the name of this Utterance.
 void save(java.lang.String fileName, javax.sound.sampled.AudioFileFormat.Type fileFormat)
          Save the audio as a WAV file in the given file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utterance

public Utterance(java.lang.String name,
                 javax.sound.sampled.AudioFormat format)
Constructs a default Utterance object.

Parameters:
name - the name of this Utterance, e.g., it can be the name of the audio file where the audio came from
format - the audio format of this Utterance
Method Detail

getName

public java.lang.String getName()
Returns the name of this Utterance.

Returns:
the name of this Utterance

getAudioFormat

public javax.sound.sampled.AudioFormat getAudioFormat()
Returns the audio format of this Utterance.

Returns:
the audio format

add

public void add(byte[] audio)
Adds an audio frame into this Utterance.

Parameters:
audio - the audio frame to add

getAudio

public byte[] getAudio()
Returns the complete audio stream of this utterance.

Returns:
the complete audio stream

getAudioTime

public float getAudioTime()
Returns the amount of time (in seconds) this Utterance lasts.

Returns:
how long is this utterance

save

public void save(java.lang.String fileName,
                 javax.sound.sampled.AudioFileFormat.Type fileFormat)
          throws java.io.IOException
Save the audio as a WAV file in the given file.

Parameters:
fileName - the name of the audio file
fileFormat - the audio file format
Throws:
java.io.IOException