Add online stream. (#28)
This commit is contained in:
@@ -11,16 +11,12 @@
|
||||
namespace sherpa_onnx {
|
||||
|
||||
struct FeatureExtractorConfig {
|
||||
int32_t sampling_rate = 16000;
|
||||
float sampling_rate = 16000;
|
||||
int32_t feature_dim = 80;
|
||||
};
|
||||
|
||||
class FeatureExtractor {
|
||||
public:
|
||||
/**
|
||||
* @param sampling_rate Sampling rate of the data used to train the model.
|
||||
* @param feature_dim Dimension of the features used to train the model.
|
||||
*/
|
||||
explicit FeatureExtractor(const FeatureExtractorConfig &config = {});
|
||||
~FeatureExtractor();
|
||||
|
||||
@@ -32,16 +28,19 @@ class FeatureExtractor {
|
||||
*/
|
||||
void AcceptWaveform(float sampling_rate, const float *waveform, int32_t n);
|
||||
|
||||
// InputFinished() tells the class you won't be providing any
|
||||
// more waveform. This will help flush out the last frame or two
|
||||
// of features, in the case where snip-edges == false; it also
|
||||
// affects the return value of IsLastFrame().
|
||||
/**
|
||||
* InputFinished() tells the class you won't be providing any
|
||||
* more waveform. This will help flush out the last frame or two
|
||||
* of features, in the case where snip-edges == false; it also
|
||||
* affects the return value of IsLastFrame().
|
||||
*/
|
||||
void InputFinished();
|
||||
|
||||
int32_t NumFramesReady() const;
|
||||
|
||||
// Note: IsLastFrame() will only ever return true if you have called
|
||||
// InputFinished() (and this frame is the last frame).
|
||||
/** Note: IsLastFrame() will only ever return true if you have called
|
||||
* InputFinished() (and this frame is the last frame).
|
||||
*/
|
||||
bool IsLastFrame(int32_t frame) const;
|
||||
|
||||
/** Get n frames starting from the given frame index.
|
||||
|
||||
Reference in New Issue
Block a user