Class WAVWriter
java.lang.Object
com.codename1.media.WAVWriter
- All Implemented Interfaces:
AutoCloseable
A class that can write raw PCM data to a WAV file.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
WAVWriter
Creates a new writer for writing a WAV file.
Parameters
-
outputFile: The output file. -
samplingRate: The sampling rate. E.g. 44100 -
channels: The number of channels. E.g. 1 or 2 -
numBits: 8 or 16
Throws
IOException
- Throws:
IOException
-
-
-
Method Details
-
write
Writes PCM data to the file.
Parameters
-
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.
Throws
IOException
- Throws:
IOException
-
-
close
Closes the writer, and writes the WAV file.
Throws
Exception
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-