net.charlesames.utility.audio
Class AudioSampleWriter

java.lang.Object
  extended by net.charlesames.utility.audio.AudioSampleWriter
All Implemented Interfaces:
java.lang.Runnable

public class AudioSampleWriter
extends java.lang.Object
implements java.lang.Runnable

Example methods for generating audio files.
The code source is http://www.builogic.com/java/javasound-read-write.html

Author:
Unknown

Constructor Summary
AudioSampleWriter(java.io.File file, javax.sound.sampled.AudioFormat format, javax.sound.sampled.AudioFileFormat.Type targetType)
          Constructor for AudioSampleWriter instances.
 
Method Summary
 void close()
           
 void run()
           
 void write(double[] interleavedSamples)
          Encode the interleaved samples and write them to the file.
 void writeInterleavedSamples(double[] interleavedSamples, int sampleCount)
          Encode the interleaved samples and write them to the file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioSampleWriter

public AudioSampleWriter(java.io.File file,
                         javax.sound.sampled.AudioFormat format,
                         javax.sound.sampled.AudioFileFormat.Type targetType)
                  throws java.io.IOException
Constructor for AudioSampleWriter instances.

Parameters:
file - The file that will receive the audio data.
format - The audio format.
targetType - The audio file format type.
Throws:
java.io.IOException
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

write

public void write(double[] interleavedSamples)
           throws java.io.IOException
Encode the interleaved samples and write them to the file.

Parameters:
interleavedSamples -
Throws:
java.io.IOException

writeInterleavedSamples

public void writeInterleavedSamples(double[] interleavedSamples,
                                    int sampleCount)
                             throws java.io.IOException
Encode the interleaved samples and write them to the file.

Parameters:
interleavedSamples -
sampleCount -
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException