jAudioFeatureExtractor.jAudioTools
Class AudioMethodsRecording

java.lang.Object
  extended by jAudioFeatureExtractor.jAudioTools.AudioMethodsRecording

public class AudioMethodsRecording
extends java.lang.Object

A holder class for static methods and internal classes relating to recording audio.

Author:
Cory McKay

Nested Class Summary
static class AudioMethodsRecording.RecordThread
          A thread for recording from a given TargetDataLine into a ByteArrayOutputStream.
static class AudioMethodsRecording.RecordToFileThread
          A thread for recording from a given TargetDataLine into an audio file belonging to one of a number of types.
 
Constructor Summary
AudioMethodsRecording()
           
 
Method Summary
static AudioMethodsRecording.RecordThread recordByteArrayOutputStream(javax.sound.sampled.TargetDataLine target_data_line)
          Records the samples coming in on the given TargetDataLine to a ByteArrayOutputStream.
static AudioMethodsRecording.RecordToFileThread recordToFile(javax.sound.sampled.TargetDataLine target_data_line, java.io.File file_to_save_to, javax.sound.sampled.AudioFileFormat.Type file_type)
          Records the samples coming in on the given TargetDataLine to the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioMethodsRecording

public AudioMethodsRecording()
Method Detail

recordByteArrayOutputStream

public static AudioMethodsRecording.RecordThread recordByteArrayOutputStream(javax.sound.sampled.TargetDataLine target_data_line)
                                                                      throws java.lang.Exception
Records the samples coming in on the given TargetDataLine to a ByteArrayOutputStream. Returns the thread that can be stopped and from which the samples can be extracted. Useful for real-time recording.

Parameters:
target_data_line - Where the samples are being recorded from.
Returns:
The thread that performs the recording.
Throws:
java.lang.Exception - Throws an exception if the parameter is null.

recordToFile

public static AudioMethodsRecording.RecordToFileThread recordToFile(javax.sound.sampled.TargetDataLine target_data_line,
                                                                    java.io.File file_to_save_to,
                                                                    javax.sound.sampled.AudioFileFormat.Type file_type)
                                                             throws java.lang.Exception
Records the samples coming in on the given TargetDataLine to the given file. Returns the thread that can be stopped when recording is complete. Useful for real-time recording.

Parameters:
target_data_line - The source of the audio to be recorded.
file_to_save_to - The file to save the audio to.
file_type - The type of audio file to save to.
Returns:
The thread that performs the recording.
Throws:
java.lang.Exception - Throws an exception if the target_data_line parameter is null or if the given file cannot be written to.