ddf.minim
Class MBufferedRecorder

java.lang.Object
  extended byddf.minim.MBufferedRecorder
All Implemented Interfaces:
AudioFileWriter, SampleStream

public class MBufferedRecorder
extends java.lang.Object
implements AudioFileWriter

MBufferedRecorder is an implementation of the AudioFileOut protocol that records to an in-memory buffer and then writes the data to disk when save() is called. Because of this it is possible to specify the file format to use for saving after the audio has already been recorded. It is also possible to save the recorded audio to multiple formats by calling save(type) for each file format you want to save to. Because the saving is performed in the same thread of execution as your Processing sketch, you can expect your sketch to hang while the audio is written to disk. How long it hangs will be proportional to the length of the audio buffer.

Author:
Damien Di Fede

Constructor Summary
MBufferedRecorder(java.lang.String fileName, javax.sound.sampled.AudioFileFormat.Type fileType, javax.sound.sampled.AudioFormat fileFormat, int bufferSize)
          Constructs a MBufferedRecorder that expects audio in the given AudioFormat and which will save to a file with given name.
 
Method Summary
 void beginRecord()
           
 void endRecord()
           
 boolean isRecording()
           
 void save()
          Saves the audio in the internal buffer to a file using the current settings for file type and file name.
 void write(float[] samp)
           
 void write(float[] sampL, float[] sampR)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBufferedRecorder

public MBufferedRecorder(java.lang.String fileName,
                         javax.sound.sampled.AudioFileFormat.Type fileType,
                         javax.sound.sampled.AudioFormat fileFormat,
                         int bufferSize)
Constructs a MBufferedRecorder that expects audio in the given AudioFormat and which will save to a file with given name.

Method Detail

save

public void save()
Saves the audio in the internal buffer to a file using the current settings for file type and file name.

Specified by:
save in interface AudioFileWriter

write

public void write(float[] samp)
Specified by:
write in interface SampleStream

write

public void write(float[] sampL,
                  float[] sampR)
Specified by:
write in interface SampleStream

beginRecord

public void beginRecord()
Specified by:
beginRecord in interface AudioFileWriter

endRecord

public void endRecord()
Specified by:
endRecord in interface AudioFileWriter

isRecording

public boolean isRecording()
Specified by:
isRecording in interface AudioFileWriter