net.beadsproject.beads.analysis
Class AudioSegmenter

java.lang.Object
  extended by net.beadsproject.beads.core.Bead
      extended by net.beadsproject.beads.core.UGen
          extended by net.beadsproject.beads.analysis.AudioSegmenter
All Implemented Interfaces:
SegmentMaker
Direct Known Subclasses:
ShortFrameSegmenter

public abstract class AudioSegmenter
extends UGen
implements SegmentMaker

An AudioSegmenter slices incoming audio data into chunks, as implemented by subclasses, usually in their calculateBuffer method, and then notifies any FeatureExtractors or other SegmentListeners that are listening.

Author:
ollie

Nested Class Summary
 
Nested classes/interfaces inherited from class net.beadsproject.beads.core.UGen
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
 
Field Summary
 
Fields inherited from class net.beadsproject.beads.core.UGen
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
 
Constructor Summary
AudioSegmenter(AudioContext context)
          Instantiates a new Segmenter.
 
Method Summary
 void addListener(FeatureExtractor<?,float[]> fe)
          Adds a FeatureExtractor as a responder to this Segmenter.
 void addSegmentListener(SegmentListener sl)
          Adds a SegmentListener as a listener to this Segmenter.
 void removeSegmentListener(SegmentListener sl)
          Removes a SegmentListerner as a listener to this Segmenter.
abstract  void resetTimeStamp()
          Reset both beginning and last time stamps to zero.
protected  void segment(TimeStamp startTime, TimeStamp endTime, float[] data)
          Called by instantiations of Segmenter, to indicate that a new segment has been created.
abstract  void setBeginningTimeStamp(TimeStamp ts)
          Set the TimeStamp of this AudioSegmenter when the AudioContext is at t=0.
abstract  void setLastTimeStamp(TimeStamp ts)
          Set the last TimeStamp of this AudioSegmenter.
 java.lang.String toString()
          Returns a String specifying the Bead's class and it's name.
 
Methods inherited from class net.beadsproject.beads.core.UGen
addDependent, addInput, addInput, calculateBuffer, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts
 
Methods inherited from class net.beadsproject.beads.core.Bead
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AudioSegmenter

public AudioSegmenter(AudioContext context)
Instantiates a new Segmenter.

Parameters:
context - the AudioContext.
Method Detail

addListener

public void addListener(FeatureExtractor<?,float[]> fe)
Adds a FeatureExtractor as a responder to this Segmenter.

Parameters:
fe - the FeatureExtractor.

addSegmentListener

public void addSegmentListener(SegmentListener sl)
Adds a SegmentListener as a listener to this Segmenter.

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

removeSegmentListener

public void removeSegmentListener(SegmentListener sl)
Removes a SegmentListerner as a listener to this Segmenter.

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

segment

protected void segment(TimeStamp startTime,
                       TimeStamp endTime,
                       float[] data)
Called by instantiations of Segmenter, to indicate that a new segment has been created.

Parameters:
startTime - double indicating the start time of the data chunk in milliseconds.
endTime - double indicating the end time of the data chunk in milliseconds.
data - the audio data.

resetTimeStamp

public abstract void resetTimeStamp()
Reset both beginning and last time stamps to zero.


setBeginningTimeStamp

public abstract void setBeginningTimeStamp(TimeStamp ts)
Set the TimeStamp of this AudioSegmenter when the AudioContext is at t=0.

Parameters:
ts -

setLastTimeStamp

public abstract void setLastTimeStamp(TimeStamp ts)
Set the last TimeStamp of this AudioSegmenter. The next time a segment is produced, the start time of the segment will be this value. The counter is reset with this operation.

Parameters:
ts -

toString

public java.lang.String toString()
Description copied from class: Bead
Returns a String specifying the Bead's class and it's name.

Overrides:
toString in class Bead
Returns:
String describing the Bead.