public class FrameProvider extends Object
PitchFrameProvider
Modifier and Type | Field and Description |
---|---|
protected double[] |
frame |
protected int |
frameLength |
protected int |
frameShift |
protected long |
frameStart
The start time of the currently analysed frame.
|
protected long |
nextFrameStart |
protected InlineDataProcessor |
processor |
protected int |
samplingRate
The sampling rate.
|
protected DoubleDataSource |
signal |
protected int |
totalRead |
protected int |
validSamplesInFrame |
Constructor and Description |
---|
FrameProvider(DoubleDataSource signal,
InlineDataProcessor processor,
int frameLength,
int frameShift,
int samplingRate,
boolean stopWhenTouchingEnd)
Initialise a FrameProvider.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getCurrentFrame() |
protected int |
getData(int nPrefilled)
Read data from input signal into current frame.
|
int |
getFrameLengthSamples()
The number of samples in the current frame.
|
double |
getFrameLengthTime()
The time length of a frame.
|
int |
getFrameShiftSamples()
The number of samples by which one frame is shifted against the next.
|
double |
getFrameShiftTime()
The amount of time by which one frame is shifted against the next.
|
long |
getFrameStartSamples()
Start position of current frame, in samples
|
double |
getFrameStartTime()
Start position of current frame, in seconds
|
double[] |
getNextFrame()
Fill the internal double array with the next frame of data.
|
int |
getSamplingRate() |
boolean |
hasMoreData()
Whether or not this frameprovider can provide another frame.
|
static void |
main(String[] args) |
void |
resetInternalTimer()
Reset the internal time stamp to 0.
|
boolean |
stopWhenTouchingEnd()
Whether or not this frame provider stops when the first frame touches the last input sample.
|
int |
validSamplesInFrame()
This tells how many valid samples have been read into the current frame (before applying the optional data processor!).
|
protected DoubleDataSource signal
protected InlineDataProcessor processor
protected int samplingRate
protected long frameStart
protected long nextFrameStart
protected int totalRead
protected double[] frame
protected int validSamplesInFrame
protected int frameShift
protected int frameLength
public FrameProvider(DoubleDataSource signal, InlineDataProcessor processor, int frameLength, int frameShift, int samplingRate, boolean stopWhenTouchingEnd)
signal
- the signal source to read fromprocessor
- an optional data processor to apply to the source signal. If null, the original data will be returned.frameLength
- the number of samples in one 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.stopWhenTouchingEnd
- whether or not this frame provider stops when the first frame touches the last input sample. When this is set to
true, the last frame will be the first one including the last sample; when this is set to false, the last frame
will be the last that still contains any data.public double getFrameStartTime()
public long getFrameStartSamples()
public int getSamplingRate()
public double getFrameShiftTime()
public int getFrameShiftSamples()
public double getFrameLengthTime()
public int getFrameLengthSamples()
public boolean stopWhenTouchingEnd()
public boolean hasMoreData()
public int validSamplesInFrame()
public double[] getNextFrame()
public double[] getCurrentFrame()
protected int getData(int nPrefilled)
nPrefilled
- number of valid values at the beginning of frame. These should not be lost or overwritten.public void resetInternalTimer()
Copyright © 2000–2016 DFKI GmbH. All rights reserved.