public class PitchFrameProvider extends FrameProvider
Modifier and Type | Field and Description |
---|---|
protected long |
currPitchmark |
protected double[] |
cutFrame |
protected int[] |
periodLengths |
protected int |
periodsInMemory |
protected DoubleDataSource |
pitchmarks |
protected int |
shiftPeriods |
protected DynamicTwoHalvesWindow |
twoHalvesWindow |
frame, frameLength, frameShift, frameStart, nextFrameStart, processor, samplingRate, signal, totalRead, validSamplesInFrame
Constructor and Description |
---|
PitchFrameProvider(DoubleDataSource signal,
DoubleDataSource pitchmarks,
InlineDataProcessor processor,
int samplingRate)
Create a new PitchFrameProvider providing one period at a time.
|
PitchFrameProvider(DoubleDataSource signal,
DoubleDataSource pitchmarks,
InlineDataProcessor processor,
int samplingRate,
int framePeriods,
int shiftPeriods)
Create a new PitchFrameProvider with a configurable number of pitch periods per frame and pitch periods to shift by.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getCurrentFrame() |
protected int |
getData(int nPrefilled)
Read data from input signal into current frame.
|
int |
getFramePeriods()
The number of periods provided in one frame.
|
double[] |
getNextFrame()
Provide the next frame of data.
|
int |
getShiftPeriods()
The number of periods by which the analysis window is shifted.
|
boolean |
hasMoreData()
Whether or not this frameprovider can provide another frame.
|
static void |
main(String[] args)
Test this pitch frame provider, by printing information about the pitch frames of an audio file.
|
getFrameLengthSamples, getFrameLengthTime, getFrameShiftSamples, getFrameShiftTime, getFrameStartSamples, getFrameStartTime, getSamplingRate, resetInternalTimer, stopWhenTouchingEnd, validSamplesInFrame
protected DoubleDataSource pitchmarks
protected int[] periodLengths
protected int shiftPeriods
protected int periodsInMemory
protected long currPitchmark
protected DynamicTwoHalvesWindow twoHalvesWindow
protected double[] cutFrame
public PitchFrameProvider(DoubleDataSource signal, DoubleDataSource pitchmarks, InlineDataProcessor processor, int samplingRate)
signal
- audio signalpitchmarks
- an array of pitchmarks; each pitch mark is in seconds from signal startprocessor
- an optional processor to apply to each input frame (e.g., a DynamicWindow)samplingRate
- number of samples per second in signalpublic PitchFrameProvider(DoubleDataSource signal, DoubleDataSource pitchmarks, InlineDataProcessor processor, int samplingRate, int framePeriods, int shiftPeriods)
signal
- audio signalpitchmarks
- an array of pitchmarks; each pitch mark is in seconds from signal startprocessor
- an optional processor to apply to each input frame (e.g., a DynamicWindow)samplingRate
- number of samples per second in signalframePeriods
- number of periods that each frame should containshiftPeriods
- number of periods that frames should be shifted byprotected int getData(int nPrefilled)
getData
in class FrameProvider
nPrefilled
- number of valid values at the beginning of frame. These should not be lost or overwritten.public double[] getNextFrame()
getNextFrame
in class FrameProvider
public double[] getCurrentFrame()
getCurrentFrame
in class FrameProvider
public int getFramePeriods()
public int getShiftPeriods()
public boolean hasMoreData()
hasMoreData
in class FrameProvider
public static void main(String[] args) throws Exception
args
- two args are expected: the name of an audio file, and the name of the corresponding pitch mark file.Exception
- ExceptionCopyright © 2000–2016 DFKI GmbH. All rights reserved.