marytts.util.data.audio
Class AudioDestination

java.lang.Object
  extended by marytts.util.data.audio.AudioDestination

public class AudioDestination
extends java.lang.Object


Constructor Summary
AudioDestination()
          Create an AudioDestination to which the audio data can be written.
 
Method Summary
 javax.sound.sampled.AudioInputStream convertToAudioInputStream()
          Convert the audio data into an AudioInputStream of the proper AudioFormat.
 javax.sound.sampled.AudioInputStream convertToAudioInputStream(javax.sound.sampled.AudioFormat audioFormat)
          Convert the audio data into an AudioInputStream of the proper AudioFormat.
 boolean isFile()
           
 boolean isInRam()
           
static void plot(double[] x)
           
static void plot(double[] x, boolean bAutoClose)
           
static void plot(double[] x, boolean bAutoClose, int milliSecondsToClose)
           
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioDestination

public AudioDestination()
                 throws java.io.IOException
Create an AudioDestination to which the audio data can be written. Depending on the mary property "synthesis.audiostore", this will use either a ByteArrayOutputStream or a FileOutputStream. The calling code is responsible for administering this AudioDestination.

Throws:
java.io.IOException - if the underlying OutputStream could not be created.
Method Detail

isInRam

public boolean isInRam()

isFile

public boolean isFile()

write

public void write(byte[] b)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Throws:
java.io.IOException

convertToAudioInputStream

public javax.sound.sampled.AudioInputStream convertToAudioInputStream(javax.sound.sampled.AudioFormat audioFormat)
                                                               throws java.io.IOException
Convert the audio data into an AudioInputStream of the proper AudioFormat.

Parameters:
audioFormat - the format of the audio data.
Returns:
an AudioInputStream from which the synthesised audio data can be read.
Throws:
java.io.IOException - if a problem occurred with the temporary file (only applies when using files as temporary storage).

convertToAudioInputStream

public javax.sound.sampled.AudioInputStream convertToAudioInputStream()
                                                               throws java.io.IOException,
                                                                      javax.sound.sampled.UnsupportedAudioFileException
Convert the audio data into an AudioInputStream of the proper AudioFormat. This method assumes that the audio data starts with a valid audio file header, so the audio format is read from the data.

Returns:
an AudioInputStream from which the synthesised audio data can be read.
Throws:
java.io.IOException - if a problem occurred with the temporary file (only applies when using files as temporary storage).
javax.sound.sampled.UnsupportedAudioFileException

plot

public static void plot(double[] x)

plot

public static void plot(double[] x,
                        boolean bAutoClose)

plot

public static void plot(double[] x,
                        boolean bAutoClose,
                        int milliSecondsToClose)