com.speech4j.sound
Class AudioOutputFile

java.lang.Object
  |
  +--com.speech4j.sound.AudioOutputFile
All Implemented Interfaces:
AudioOutput

public class AudioOutputFile
extends java.lang.Object
implements AudioOutput

AudioOutput to a file. This is a preferable class for handling big amounts of audio data (for example CD creation)

Version:
1.1
Author:
Pavel Vlasov

Constructor Summary
AudioOutputFile(java.lang.String fileName, javax.sound.sampled.AudioFormat format)
          Creates AudioOutputFile
 
Method Summary
 void close()
          Closes output
 long length()
          Returns size of output.
 double time()
          Returns time length of output.
 void write(AudioBuffer buffer)
          Writes AudioBuffer performing format conversion if necessary.
 void write(javax.sound.sampled.AudioInputStream ais, int cnt)
          Writes cnt bytes from AudioInputStream performing format conversion if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioOutputFile

public AudioOutputFile(java.lang.String fileName,
                       javax.sound.sampled.AudioFormat format)
                throws java.io.FileNotFoundException,
                       java.io.IOException
Creates AudioOutputFile

Parameters:
fileName - File name
format - AudioFormat
Throws:
java.io.FileNotFoundException
java.io.IOException
Method Detail

write

public void write(AudioBuffer buffer)
           throws java.io.IOException,
                  SoundException
Writes AudioBuffer performing format conversion if necessary.

Specified by:
write in interface AudioOutput
Parameters:
buffer - Audio buffer
Throws:
java.io.IOException
SoundException

write

public void write(javax.sound.sampled.AudioInputStream ais,
                  int cnt)
           throws java.io.IOException,
                  SoundException
Writes cnt bytes from AudioInputStream performing format conversion if necessary.

Specified by:
write in interface AudioOutput
Parameters:
ais - AudioInputStream
cnt - number of bytes to write
Throws:
java.io.IOException
SoundException

close

public void close()
           throws java.io.IOException
Closes output

Specified by:
close in interface AudioOutput
Throws:
java.io.IOException

length

public long length()
            throws java.io.IOException
Returns size of output.

Specified by:
length in interface AudioOutput
Returns:
size of output in bytes.
Throws:
java.io.IOException

time

public double time()
            throws java.io.IOException
Returns time length of output.

Specified by:
time in interface AudioOutput
Returns:
length of output in seconds.
Throws:
java.io.IOException


Copyright © 2003 Pavel Vlasov. All Rights Reserved.