34#ifndef KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_
35#define KALDI_NATIVE_FBANK_CSRC_ONLINE_FEATURE_H_
76 const float *
At(int32_t index)
const;
91 std::deque<std::vector<float>> items_;
92 int32_t items_to_hold_;
93 int32_t first_available_index_ = 0;
113 int32_t
Dim()
const {
return computer_.Dim(); }
117 return computer_.GetFrameOptions().frame_shift_ms / 1000.0f;
134 const float *
GetFrame(int32_t frame)
const {
return features_.At(frame); }
155 void Pop(int32_t n) { features_.Pop(n); }
165 void ComputeFeatures();
174 bool input_finished_ =
179 int64_t waveform_offset_ = 0;
184 std::vector<float> waveform_remainder_;
Stores the windowing coefficients and applies them to a frame.
Definition feature-window.h:156
This is a templated class for online feature extraction; it's templated on a class like MfccComputer ...
Definition online-feature.h:107
void InputFinished()
InputFinished() tells the class you won't be providing any more waveform.
OnlineGenericBaseFeature(const typename C::Options &opts)
Construct from the options class of the wrapped computer C.
int32_t NumFramesReady() const
Return the number of frames that are already computed.
Definition online-feature.h:121
const float * GetFrame(int32_t frame) const
Return a pointer to the frame-th feature vector.
Definition online-feature.h:134
void Pop(int32_t n)
Discard the first n frames.
Definition online-feature.h:155
float FrameShiftInSeconds() const
Return the frame shift in seconds.
Definition online-feature.h:116
void AcceptWaveform(float sampling_rate, const float *waveform, int32_t n)
This would be called from the application, when you get more wave data.
bool IsLastFrame(int32_t frame) const
Return true if frame is the last frame.
Definition online-feature.h:127
int32_t Dim() const
Return the dimension of the output features.
Definition online-feature.h:113
This class serves as a storage for feature vectors with an option to limit the memory usage by removi...
Definition online-feature.h:59
int32_t Size() const
This method returns the size as if no "recycling" had happened, i.e.
~RecyclingVector()=default
Destructor.
void PushBack(std::vector< float > item)
Append one feature vector to the end.
RecyclingVector(int32_t items_to_hold=-1)
By default it does not remove any elements.
RecyclingVector & operator=(const RecyclingVector &)=delete
Assignment is not allowed.
RecyclingVector(const RecyclingVector &)=delete
Copy construction is not allowed.
void Pop(int32_t n)
Discard the first n frames.
const float * At(int32_t index) const
Return a pointer to the feature vector at the given index.
Copyright 2009-2012 Karel Vesely 2016 Johns Hopkins University (author: Daniel Povey) Copyright (c) 2...
Copyright 2009-2011 Karel Vesely; Petr Motlicek; Saarland University 2014-2016 Johns Hopkins Universi...
Copyright (c) 2025 Xiaomi Corporation (authors: Fangjun Kuang).
Waveform windowing and frame extraction.
This file is part of kaldi-native-fbank.
Definition feature-cmvn.h:42
OnlineGenericBaseFeature< RawAudioSamplesComputer > OnlineRawAudioSamples
Streaming raw audio samples, framed without any processing.
Definition online-feature.h:188
OnlineGenericBaseFeature< MfccComputer > OnlineMfcc
Streaming MFCC features; see MfccComputer.
Definition online-feature.h:194
OnlineGenericBaseFeature< FbankComputer > OnlineFbank
Streaming filter-bank features; see FbankComputer.
Definition online-feature.h:191
OnlineGenericBaseFeature< WhisperFeatureComputer > OnlineWhisperFbank
Streaming Whisper log-mel features; see WhisperFeatureComputer.
Definition online-feature.h:197
Copyright (c) 2023 Xiaomi Corporation (authors: Fangjun Kuang).