net.beadsproject.beads.analysis
Class Analyzer

java.lang.Object
  extended by net.beadsproject.beads.analysis.Analyzer
All Implemented Interfaces:
SegmentMaker

public class Analyzer
extends java.lang.Object
implements SegmentMaker

The Class Analyzer sets up a quick'n'easy audio analysis chain which can then be plugged into a realtime or non-realtime audio stream. Tell the Analyzer what features you want to extract using a list of classes, corresponding to the FeatureExtractors you want. You can then add a SegmentListener to the Analyzer to monitor new features. Analyzer is a work in progress.


Nested Class Summary
static class Analyzer.AnalysisSettings
          The Class AnalysisSettings.
 
Constructor Summary
Analyzer(AudioContext ac, java.util.List<java.lang.Class<? extends FeatureExtractor<?,?>>> extractors)
          Instantiates a new analyzer.
Analyzer(AudioContext ac, java.util.List<java.lang.Class<? extends FeatureExtractor<?,?>>> extractors, Analyzer.AnalysisSettings settings)
          Instantiates a new analyzer.
 
Method Summary
 void addBeatListener(SegmentListener sl)
          Adds a {#link SegmentListener} which will listen to the beats detected by this Analyzer.
 void addSegmentListener(SegmentListener sl)
          Adds the SegmentListener.
 java.lang.Object getElement(java.lang.Class<?> classID)
          Gets the extractor or other element of the given class type.
 FeatureFrame getLastBeatFrame()
          Gets the last beat frame.
 FeatureFrame getLastLowLevelFrame()
          Gets the last low level frame.
 FeatureSet getResults()
          Gets the results from the analysis, which is a FeatureSet containing feature tracks: "Low Level" for low level features and "Beat" for beat level features.
 void listenTo(UGen ugen)
          Listen to this input ugen.
 void removeBeatListener(SegmentListener sl)
          Removes the {#link SegmentListener} from listening to the beats detected by this Analyzer.
 void removeSegmentListener(SegmentListener sl)
          Removes the SegmentListener.
 void setFrameMemory(int fm)
          Sets the frame memory for FeatureTracks stored by this Analyzer.
 void updateFrom(UGen ugen)
          Update from this source ugen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Analyzer

public Analyzer(AudioContext ac,
                java.util.List<java.lang.Class<? extends FeatureExtractor<?,?>>> extractors)
Instantiates a new analyzer.

Parameters:
ac - the ac
extractors - the extractors

Analyzer

public Analyzer(AudioContext ac,
                java.util.List<java.lang.Class<? extends FeatureExtractor<?,?>>> extractors,
                Analyzer.AnalysisSettings settings)
Instantiates a new analyzer.

Parameters:
ac - the ac
extractors - the extractors
settings - the settings
Method Detail

addSegmentListener

public void addSegmentListener(SegmentListener sl)
Description copied from interface: SegmentMaker
Adds the SegmentListener.

Specified by:
addSegmentListener in interface SegmentMaker
Parameters:
sl - the segment listener.

removeSegmentListener

public void removeSegmentListener(SegmentListener sl)
Description copied from interface: SegmentMaker
Removes the SegmentListener.

Specified by:
removeSegmentListener in interface SegmentMaker
Parameters:
sl - the segment listener.

addBeatListener

public void addBeatListener(SegmentListener sl)
Adds a {#link SegmentListener} which will listen to the beats detected by this Analyzer.

Parameters:
sl - a SegmentListener.

removeBeatListener

public void removeBeatListener(SegmentListener sl)
Removes the {#link SegmentListener} from listening to the beats detected by this Analyzer.

Parameters:
sl - a SegmentListener.

listenTo

public void listenTo(UGen ugen)
Listen to this input ugen.

Parameters:
ugen - the ugen

updateFrom

public void updateFrom(UGen ugen)
Update from this source ugen.

Parameters:
ugen -

getLastLowLevelFrame

public FeatureFrame getLastLowLevelFrame()
Gets the last low level frame.

Returns:
the last low level frame

getLastBeatFrame

public FeatureFrame getLastBeatFrame()
Gets the last beat frame.

Returns:
the last beat frame

getElement

public java.lang.Object getElement(java.lang.Class<?> classID)
Gets the extractor or other element of the given class type.

Parameters:
classID -
Returns:

getResults

public FeatureSet getResults()
Gets the results from the analysis, which is a FeatureSet containing feature tracks: "Low Level" for low level features and "Beat" for beat level features.

Returns:
the results set.

setFrameMemory

public void setFrameMemory(int fm)
Sets the frame memory for FeatureTracks stored by this Analyzer. If unset, or set to -1, the number of frames stored is unlimited, which is likely to lead to intensive memory use. When set, only the specified number of most recent frames are stored.

Parameters:
fm - number of FeatureFrames stored, -1 for unlimited.