jAudioFeatureExtractor.jAudioTools
Class FeatureProcessor

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

public class FeatureProcessor
extends java.lang.Object

This class is used to pre-process and extract features from audio recordings. An object of this class should be instantiated with parameters indicating the details of how features are to be extracted.

The extractFeatures method should be called whenever recordings are available to be analyzed. This mehtod should be called once for each recording. It will write the extracted feature values to an XML file after each call. This will also save feature definitions to another XML file.

The finalize method should be called when all features have been extracted. this will finish writing the feature values to the XML file.

Features are extracted for each window and, when appropriate, the average and standard deviation of each of these features is extracted for each recording.

Author:
Cory McKay

Constructor Summary
FeatureProcessor(int window_size, double window_overlap, double sampling_rate, boolean normalise, FeatureExtractor[] all_feature_extractors, boolean[] features_to_save_among_all, boolean save_features_for_each_window, boolean save_overall_recording_features, java.io.OutputStream feature_values_save_path, java.io.OutputStream feature_definitions_save_path, int outputType, Cancel cancel, AggregatorContainer container)
          Validates and stores the configuration to use for extracting features from audio recordings.
 
Method Summary
 void extractFeatures(java.io.File recording_file, Updater updater)
          Extract the features from the provided audio file.
 void finalize()
          Write the ending tags to the feature_vector_file XML file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureProcessor

public FeatureProcessor(int window_size,
                        double window_overlap,
                        double sampling_rate,
                        boolean normalise,
                        FeatureExtractor[] all_feature_extractors,
                        boolean[] features_to_save_among_all,
                        boolean save_features_for_each_window,
                        boolean save_overall_recording_features,
                        java.io.OutputStream feature_values_save_path,
                        java.io.OutputStream feature_definitions_save_path,
                        int outputType,
                        Cancel cancel,
                        AggregatorContainer container)
                 throws java.lang.Exception
Validates and stores the configuration to use for extracting features from audio recordings. Prepares the feature_vector_file and feature_key_file XML files for saving.

Parameters:
window_size - The size of the windows that the audio recordings are to be broken into.
window_overlap - The fraction of overlap between adjacent windows. Must be between 0.0 and less than 1.0, with a value of 0.0 meaning no overlap.
sampling_rate - The sampling rate that all recordings are to be converted to before feature extraction
normalise - Whether or not to normalise recordings before feature extraction.
all_feature_extractors - All features that can be extracted.
features_to_save_among_all - Which features are to be saved. Entries correspond to the all_feature_extractors parameter.
save_features_for_each_window - Whether or not to save features individually for each window.
save_overall_recording_features - Whetehr or not to save the average and standard deviation of each feature accross all windows.
feature_values_save_path - The path of the feature_vector_file XML file to save feature values to.
feature_definitions_save_path - The path of the feature_key_file file to save feature definitions to.
Throws:
java.lang.Exception - Throws an informative exception if the input parameters are invalid.
Method Detail

extractFeatures

public void extractFeatures(java.io.File recording_file,
                            Updater updater)
                     throws java.lang.Exception
Extract the features from the provided audio file. This includes pre-processing involving sample rate conversion, windowing and, possibly, normalisation. The feature values are automatically saved to the feature_vector_file XML file referred to by the values_writer field. The definitions of the features that are saved are also saved to the feature_key_file XML file referred to by the definitions_writer field.

Parameters:
recording_file - The audio file to extract features from.
Throws:
java.lang.Exception

finalize

public void finalize()
              throws java.lang.Exception
Write the ending tags to the feature_vector_file XML file. Close the DataOutputStreams that were used to write it.

This method should be called when all features have been extracted.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Exception - Throws an exception if cannot write or close the output streams.