public class WAVWriter extends Object implements AutoCloseable
Constructor and Description |
---|
WAVWriter(File outputFile,
int samplingRate,
int channels,
int numBits)
Creates a new writer for writing a WAV file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the writer, and writes the WAV file.
|
void |
write(float[] pcmData,
int offset,
int len)
Writes PCM data to the file.
|
public WAVWriter(File outputFile, int samplingRate, int channels, int numBits) throws IOException
outputFile
- The output file.samplingRate
- The sampling rate. E.g. 44100channels
- The number of channels. E.g. 1 or 2numBits
- 8 or 16IOException
public void write(float[] pcmData, int offset, int len) throws IOException
pcmData
- PCM data to write. These are float values between -1 and 1.offset
- Offset in pcmData array to start writing.len
- Length in pcmData array to write.IOException
public void close() throws Exception
close
in interface AutoCloseable
Exception