be.hogent.tarsos.dsp.pitch
Class PitchProcessor

java.lang.Object
  extended by be.hogent.tarsos.dsp.pitch.PitchProcessor
All Implemented Interfaces:
AudioProcessor

public class PitchProcessor
extends java.lang.Object
implements AudioProcessor

Is responsible to call a pitch estimation algorithm. It also calculates progress. The underlying pitch detection algorithm must implement the PitchDetector interface.

Author:
Joren Six

Nested Class Summary
static class PitchProcessor.PitchEstimationAlgorithm
          A list of pitch estimation algorithms.
 
Constructor Summary
PitchProcessor(PitchProcessor.PitchEstimationAlgorithm algorithm, float sampleRate, int bufferSize, PitchDetectionHandler handler)
          Initialize a new pitch processor.
 
Method Summary
 boolean process(AudioEvent audioEvent)
          Process the audio event.
 void processingFinished()
          Notify the AudioProcessor that no more data is available and processing has finished.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PitchProcessor

public PitchProcessor(PitchProcessor.PitchEstimationAlgorithm algorithm,
                      float sampleRate,
                      int bufferSize,
                      PitchDetectionHandler handler)
Initialize a new pitch processor.

Parameters:
algorithm - An enum defining the algorithm.
sampleRate - The sample rate of the buffer (Hz).
bufferSize - The size of the buffer in samples.
handler - The handler handles detected pitch.
Method Detail

process

public boolean process(AudioEvent audioEvent)
Description copied from interface: AudioProcessor
Process the audio event. Do the actual signal processing on an (optionally) overlapping buffer.

Specified by:
process in interface AudioProcessor
Parameters:
audioEvent - The audio event that contains audio data.
Returns:
False if the chain needs to stop here, true otherwise. This can be used to implement e.g. a silence detector.

processingFinished

public void processingFinished()
Description copied from interface: AudioProcessor
Notify the AudioProcessor that no more data is available and processing has finished. Can be used to deallocate resources or cleanup.

Specified by:
processingFinished in interface AudioProcessor