marytts.signalproc.analysis
Class PitchFrameAnalyser

java.lang.Object
  extended by marytts.signalproc.process.FrameProvider
      extended by marytts.signalproc.process.PitchFrameProvider
          extended by marytts.signalproc.analysis.PitchFrameAnalyser
Direct Known Subclasses:
LpcPitchSynchronousAnalyser

public abstract class PitchFrameAnalyser
extends PitchFrameProvider

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

Field Summary
protected  FrameBasedAnalyser.FrameAnalysisResult[] analysisResults
          Array containing the analysis results, filled by analyseAllFrames().
protected  DynamicWindow analysisWindow
           
 
Fields inherited from class marytts.signalproc.process.PitchFrameProvider
currPitchmark, cutFrame, periodLengths, periodsInMemory, pitchmarks, shiftPeriods, twoHalvesWindow
 
Fields inherited from class marytts.signalproc.process.FrameProvider
frame, frameLength, frameShift, frameStart, nextFrameStart, processor, samplingRate, signal, totalRead, validSamplesInFrame
 
Constructor Summary
PitchFrameAnalyser(DoubleDataSource signal, DoubleDataSource pitchmarks, int windowType, int samplingRate)
          Initialise a PitchFrameAnalyser.
PitchFrameAnalyser(DoubleDataSource signal, DoubleDataSource pitchmarks, int windowType, int samplingRate, int framePeriods, int shiftPeriods)
          Create a new PitchFrameAnalyser with a configurable number of pitch periods per frame and pitch periods to shift by.
 
Method Summary
abstract  java.lang.Object analyse(double[] frame)
          Apply this PitchFrameAnalyser to the given data.
 FrameBasedAnalyser.FrameAnalysisResult[] analyseAllFrames()
          Analyse the entire signal as frames.
 FrameBasedAnalyser.FrameAnalysisResult[] analyseAvailableFrames()
          Analyse the currently available input signal as frames.
 FrameBasedAnalyser.FrameAnalysisResult analyseNextFrame()
          The public method to call in order to trigger the analysis of the next frame.
protected  FrameBasedAnalyser.FrameAnalysisResult constructAnalysisResult(java.lang.Object analysisResult)
           
 
Methods inherited from class marytts.signalproc.process.PitchFrameProvider
getCurrentFrame, getData, getFramePeriods, getNextFrame, getShiftPeriods, hasMoreData, main
 
Methods inherited from class marytts.signalproc.process.FrameProvider
getFrameLengthSamples, getFrameLengthTime, getFrameShiftSamples, getFrameShiftTime, getFrameStartSamples, getFrameStartTime, getSamplingRate, resetInternalTimer, stopWhenTouchingEnd, validSamplesInFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

analysisWindow

protected DynamicWindow analysisWindow

analysisResults

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

Constructor Detail

PitchFrameAnalyser

public PitchFrameAnalyser(DoubleDataSource signal,
                          DoubleDataSource pitchmarks,
                          int windowType,
                          int samplingRate)
Initialise a PitchFrameAnalyser.

Parameters:
signal - the signal source to read from
pitchmarks - the source of the pitchmarks, in seconds from the start of signal
windowType - type of analysis window to use, @see{de.dfki.signalproc.window.Window#getAvailableTypes()}
samplingRate - the number of samples in one second.

PitchFrameAnalyser

public PitchFrameAnalyser(DoubleDataSource signal,
                          DoubleDataSource pitchmarks,
                          int windowType,
                          int samplingRate,
                          int framePeriods,
                          int shiftPeriods)
Create a new PitchFrameAnalyser with a configurable number of pitch periods per frame and pitch periods to shift by.

Parameters:
signal - audio signal
pitchmarks - an array of pitchmarks; each pitch mark is in seconds from signal start
windowType - type of analysis window to use, @see{de.dfki.signalproc.window.Window#getAvailableTypes()}
samplingRate - number of samples per second in signal
framePeriods - number of periods that each frame should contain
shiftPeriods - number of periods that frames should be shifted by
Method Detail

analyseNextFrame

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

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

analyseAllFrames

public FrameBasedAnalyser.FrameAnalysisResult[] 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.

Returns:
an array containing all frame analysis results.

analyseAvailableFrames

public FrameBasedAnalyser.FrameAnalysisResult[] 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.

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

analyse

public abstract java.lang.Object analyse(double[] frame)
Apply this PitchFrameAnalyser to the given data.

Parameters:
frame - the data to analyse, which is expected to be the number of pitch periods requested from this PitchFrameAnalyser, @see{#getFramePeriods()}.
Returns:
An analysis result. The data type depends on the concrete analyser.
Throws:
java.lang.IllegalArgumentException - if frame does not have the prescribed length

constructAnalysisResult

protected FrameBasedAnalyser.FrameAnalysisResult constructAnalysisResult(java.lang.Object analysisResult)