Class FrameBasedAnalyser<T>

  extended by marytts.signalproc.process.FrameProvider
      extended by marytts.signalproc.analysis.FrameBasedAnalyser<T>
Direct Known Subclasses:
EnergyAnalyser, F0Tracker.CandidateEstimator, LpcAnalyser, ShortTermAutocorrelationAnalyser, ShortTermCepstrumAnalyser, ShortTermSpectrumAnalyser

public abstract class FrameBasedAnalyser<T>
extends FrameProvider

Marc Schröder The base class for all frame-based signal analysis algorithms

Nested Class Summary
static class FrameBasedAnalyser.FrameAnalysisResult<T>
Field Summary
protected  FrameBasedAnalyser.FrameAnalysisResult<T>[] analysisResults
          Array containing the analysis results, filled by analyseAllFrames().
Fields inherited from class marytts.signalproc.process.FrameProvider
frame, frameLength, frameShift, frameStart, nextFrameStart, processor, samplingRate, signal, totalRead, validSamplesInFrame
Constructor Summary
FrameBasedAnalyser(DoubleDataSource signal, Window window, int frameShift, int samplingRate)
          Initialise a FrameBasedAnalyser.
Method Summary
abstract  T analyse(double[] frame)
          Apply this FrameBasedAnalyser to the given data.
 FrameBasedAnalyser.FrameAnalysisResult<T>[] analyseAllFrames()
          Analyse the entire signal as frames.
 FrameBasedAnalyser.FrameAnalysisResult<T>[] analyseAvailableFrames()
          Analyse the currently available input signal as frames.
 FrameBasedAnalyser.FrameAnalysisResult<T> analyseNextFrame()
          The public method to call in order to trigger the analysis of the next frame.
protected  FrameBasedAnalyser.FrameAnalysisResult<T> constructAnalysisResult(T analysisResult)
Methods inherited from class marytts.signalproc.process.FrameProvider
getCurrentFrame, getData, getFrameLengthSamples, getFrameLengthTime, getFrameShiftSamples, getFrameShiftTime, getFrameStartSamples, getFrameStartTime, getNextFrame, getSamplingRate, hasMoreData, main, resetInternalTimer, stopWhenTouchingEnd, validSamplesInFrame
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected FrameBasedAnalyser.FrameAnalysisResult<T>[] analysisResults
Array containing the analysis results, filled by analyseAllFrames(). Can be used for future reference to the results.

Constructor Detail


public FrameBasedAnalyser(DoubleDataSource signal,
                          Window window,
                          int frameShift,
                          int samplingRate)
Initialise a FrameBasedAnalyser.

signal - the signal source to read from
window - the window function to apply to each frame
frameShift - the number of samples by which to shift the window from one frame analysis to the next; if this is smaller than window.getLength(), frames will overlap.
samplingRate - the number of samples in one second.
Method Detail


public FrameBasedAnalyser.FrameAnalysisResult<T> analyseNextFrame()
The public method to call in order to trigger the analysis of the next frame.

the analysis result, or null if no part of the signal is left to analyse.


public FrameBasedAnalyser.FrameAnalysisResult<T>[] analyseAllFrames()
Analyse the entire signal as frames. Stop as soon as the first frame reaches or passes the end of the signal. Repeated access to this method returns a stored version of the results.

an array containing all frame analysis results.


public FrameBasedAnalyser.FrameAnalysisResult<T>[] analyseAvailableFrames()
Analyse the currently available input signal as frames. This method is intended for live signals such as microphone data. Stop when the amount of data available from the input is less than one frame length. Repeated access to this method will read new data if new data has become available in the meantime.

an array containing the frame analysis results for the data that is currently available, or an empty array if no new data is available.


public abstract T analyse(double[] frame)
Apply this FrameBasedAnalyser to the given data.

frame - the data to analyse, which must be of the length prescribed by this FrameBasedAnalyser, i.e. by @see{#getFrameLengthSamples()}.
An analysis result. The data type depends on the concrete analyser.
java.lang.IllegalArgumentException - if frame does not have the prescribed length


protected FrameBasedAnalyser.FrameAnalysisResult<T> constructAnalysisResult(T analysisResult)