ddf.minim
Class MStreamRecorder

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

public class MStreamRecorder
extends java.lang.Object
implements AudioFileWriter

MStreamRecorder using the Tritonus AudioOutputStream class to stream audio directly to disk. The limitation of this approach is that the file format and the file name must be known before recording begins because the file must be created. The advantage is that you do not incur the overhead of an in-memory buffer and saving will not cause your sketch to hang because all the audio is already on disk and all that must be done is closing the file. Unlike MBufferedRecorder, specifying the file format upon saving will do nothing and you cannot easily save your recorded audio to multiple formats. There are also fewer formats available to save in, limiting you to AIFF, AU, and WAV.

Author:
Damien Di Fede

Constructor Summary
MStreamRecorder(java.lang.String fileName, javax.sound.sampled.AudioFileFormat.Type fileType, javax.sound.sampled.AudioFormat fileFormat, int bufferSize)
           
 
Method Summary
 void beginRecord()
           
 void endRecord()
           
 boolean isRecording()
           
 void save()
          Finishes the recording process by closing the file.
 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

MStreamRecorder

public MStreamRecorder(java.lang.String fileName,
                       javax.sound.sampled.AudioFileFormat.Type fileType,
                       javax.sound.sampled.AudioFormat fileFormat,
                       int bufferSize)
Parameters:
fileName -
fileType -
fileFormat -
Method Detail

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

save

public void save()
Finishes the recording process by closing the file.

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