|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream com.softsynth.util.RandomOutputStream com.softsynth.jsyn.util.WAVFileWriter
public class WAVFileWriter
Writes audio data to a random access file in WAV format. Note that if you are overwriting a RandomAccessFile then you should clear it before you start. This will prevent having the remainder of a longer file stuck at the end of a short file. In Java 1.2 you can call setLength(0).
Constructor Summary | |
---|---|
WAVFileWriter(java.io.RandomAccessFile file)
|
Method Summary | |
---|---|
void |
fixSizes()
Fix RIFF and data chunk sizes based on final size. |
static void |
main(java.lang.String[] args)
|
void |
write(short[] samples,
int channelsPerFrame,
int sampleRate)
Write a complete WAV file containing the array of short samples. |
void |
writeDataChunk(short[] samples)
Write a data chunk to the WAV file containing the given short array. |
void |
writeDataChunkHeader(int size)
Write a 'data' chunk header to the WAV file. |
void |
writeFormatChunk(int bitsPerSample,
int channelsPerFrame,
int sampleRate)
Write an 'fmt ' chunk to the WAV file containing the given information. |
void |
writeHeader(int size)
Write a 'RIFF' file header and a 'WAVE' ID to the WAV file. |
void |
writeHeader(int channelsPerFrame,
int sampleRate)
Write a simple WAV header for 16 bit PCM data. |
void |
writeIntLittle(int n)
Write a 32 bit intgeer to the stream in Little Endian format. |
void |
writeShortLittle(short n)
Write a 16 bit intgeer to the stream in Little Endian format. |
Methods inherited from class com.softsynth.util.RandomOutputStream |
---|
getFilePointer, seek, write, write, write |
Methods inherited from class java.io.OutputStream |
---|
close, flush |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WAVFileWriter(java.io.RandomAccessFile file) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void writeIntLittle(int n) throws java.io.IOException
java.io.IOException
public void writeShortLittle(short n) throws java.io.IOException
java.io.IOException
public void writeFormatChunk(int bitsPerSample, int channelsPerFrame, int sampleRate) throws java.io.IOException
java.io.IOException
public void writeDataChunk(short[] samples) throws java.io.IOException
java.io.IOException
public void writeDataChunkHeader(int size) throws java.io.IOException
java.io.IOException
public void writeHeader(int size) throws java.io.IOException
java.io.IOException
public void writeHeader(int channelsPerFrame, int sampleRate) throws java.io.IOException
java.io.IOException
public void fixSizes() throws java.io.IOException
java.io.IOException
public void write(short[] samples, int channelsPerFrame, int sampleRate) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |