|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xiph.speex.AudioFileWriter
org.xiph.speex.PcmWaveWriter
Writes basic PCM wave files from binary audio data.
Here's an example that writes 2 seconds of silence
PcmWaveWriter s_wsw = new PcmWaveWriter();
byte[] silence = new byte[16*2*44100];
wsw.SetFormat(2, 44100);
wsw.Open("C:\\out.wav");
wsw.WriteHeader();
wsw.WriteData(silence, 0, silence.length);
wsw.WriteData(silence, 0, silence.length);
wsw.Close();
| Field Summary | |
private int |
channels
|
private java.io.RandomAccessFile |
raf
|
private int |
sampleRate
|
private int |
size
|
| Constructor Summary | |
PcmWaveWriter()
Constructor. |
|
PcmWaveWriter(int channels,
int sampleRate)
Constructor. |
|
| Method Summary | |
void |
close()
Closes the output file. |
void |
open(java.lang.String filename)
Open the output file. |
private void |
setFormat(int channels,
int sampleRate)
Sets the output format. |
void |
writeHeader(java.lang.String comment)
Writes the initial data chunks that start the wave file. |
void |
writePacket(byte[] data,
int offset,
int len)
Writes a packet of audio. |
| Methods inherited from class org.xiph.speex.AudioFileWriter |
writeInt, writeInt, writeLong, writeShort, writeShort |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.io.RandomAccessFile raf
private int channels
private int sampleRate
private int size
| Constructor Detail |
public PcmWaveWriter()
public PcmWaveWriter(int channels,
int sampleRate)
channels - sampleRate - | Method Detail |
private void setFormat(int channels,
int sampleRate)
channels - sampleRate -
public void close()
throws java.io.IOException
close in class AudioFileWriterjava.io.IOException
public void open(java.lang.String filename)
throws java.io.IOException
open in class AudioFileWriterfilename - filename to open.
java.io.IOException
public void writeHeader(java.lang.String comment)
throws java.io.IOException
writeHeader in class AudioFileWritercomment - ignored by the WAV header.
java.io.IOException
public void writePacket(byte[] data,
int offset,
int len)
throws java.io.IOException
writePacket in class AudioFileWriterdata - audio dataoffset - the offset from which to start reading the data.len - the length of data to read.
java.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||