public class WaveformWriter extends java.lang.Object implements AudioProcessor
Writes a WAV-file to disk. It stores the bytes to a raw file and when the processingFinished method is called it prepends the raw file with a header to make it a legal WAV-file.
Writing a RAW file first and then a header is needed because the header contains fields for the size of the file, which is unknown beforehand. See Subchunk2Size and ChunkSize on this wav file reference.
| Constructor and Description |
|---|
WaveformWriter(javax.sound.sampled.AudioFormat format,
java.lang.String fileName)
Initialize the writer.
|
WaveformWriter(TarsosDSPAudioFormat format,
java.lang.String fileName) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
process(AudioEvent audioEvent)
Process the audio event.
|
void |
processingFinished()
Notify the AudioProcessor that no more data is available and processing
has finished.
|
public WaveformWriter(javax.sound.sampled.AudioFormat format,
java.lang.String fileName)
format - The format of the received bytes.fileName - The name of the wav file to store.public WaveformWriter(TarsosDSPAudioFormat format, java.lang.String fileName)
public boolean process(AudioEvent audioEvent)
AudioProcessorprocess in interface AudioProcessoraudioEvent - The audio event that contains audio data.public void processingFinished()
AudioProcessorprocessingFinished in interface AudioProcessor