public class Utterance
extends java.lang.Object
Constructor and Description |
---|
Utterance(java.lang.String name,
javax.sound.sampled.AudioFormat format)
Constructs a default Utterance object.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public Utterance(java.lang.String name, javax.sound.sampled.AudioFormat format)
name
- the name of this Utterance, e.g., it can be the name of the audio file where the audio came fromformat
- the audio format of this Utterancepublic java.lang.String getName()
public javax.sound.sampled.AudioFormat getAudioFormat()
public void add(byte[] audio)
audio
- the audio frame to addpublic byte[] getAudio()
public float getAudioTime()
public void save(java.lang.String fileName, javax.sound.sampled.AudioFileFormat.Type fileFormat) throws java.io.IOException
fileName
- the name of the audio filefileFormat
- the audio file formatjava.io.IOException
- if IO went wrong