public class WaveFileWriter extends java.lang.Object implements AudioOutputStream
| Constructor and Description |
|---|
WaveFileWriter(java.io.File outputFile)
Create a writer that will write to the specified file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
setBitsPerSample(int i)
Only 16 bit samples supported at the moment.
|
void |
setFrameRate(int frameRate) |
void |
setSamplesPerFrame(int samplesPerFrame)
For stereo, set this to 2.
|
void |
write(double value)
Write audio to the WAV file.
|
void |
write(double[] buffer)
Write audio to the WAV file.
|
void |
write(double[] buffer,
int start,
int count)
Write audio to the WAV file.
|
void |
writeDataChunkHeader()
Write a 'data' chunk header to the WAV file.
|
void |
writeFormatChunk()
Write an 'fmt ' chunk to the WAV file containing the given information.
|
void |
writeIntLittle(int n)
Write a 32 bit integer to the stream in Little Endian format.
|
void |
writeShortLittle(short n)
Write a 16 bit intgeer to the stream in Little Endian format.
|
public WaveFileWriter(java.io.File outputFile)
throws java.io.FileNotFoundException
outputFile - java.io.FileNotFoundExceptionpublic void setFrameRate(int frameRate)
public void setSamplesPerFrame(int samplesPerFrame)
public void setBitsPerSample(int i)
public void close()
throws java.io.IOException
close in interface AudioOutputStreamjava.io.IOExceptionpublic void write(double[] buffer)
throws java.io.IOException
write in interface AudioOutputStreamjava.io.IOExceptionpublic void write(double value)
throws java.io.IOException
write in interface AudioOutputStreamjava.io.IOExceptionpublic void write(double[] buffer,
int start,
int count)
throws java.io.IOException
write in interface AudioOutputStreamjava.io.IOExceptionpublic void writeIntLittle(int n)
throws java.io.IOException
java.io.IOExceptionpublic void writeShortLittle(short n)
throws java.io.IOException
java.io.IOExceptionpublic void writeFormatChunk()
throws java.io.IOException
java.io.IOExceptionpublic void writeDataChunkHeader()
throws java.io.IOException
java.io.IOException