|
kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
|
NeMo-compatible buffered streaming filter-bank features. More...
#include <online-nemo-fbank.h>
Public Member Functions | |
| OnlineNemoFbank (const NemoFbankOptions &opts) | |
| Construct from the given options. | |
| int32_t | Dim () const |
| Return the number of mel bins. | |
| float | FrameShiftInSeconds () const |
| Return the frame shift in seconds. | |
| int32_t | NumFramesReady () const |
| Return the number of whole frames that are ready. | |
| int32_t | NumTrailingSamples () const |
| Return the number of buffered samples that do not make up a whole hop. | |
| bool | IsLastFrame (int32_t frame) const |
| Return true if frame is the last frame. | |
| void | AcceptWaveform (float sampling_rate, const float *waveform, int32_t n) |
| Add more waveform samples; the sampling rate must match opts.samp_freq. | |
| void | InputFinished () |
| Tell the class that no more waveform will be added. | |
| std::vector< float > | GetFrames (int32_t frame_index, int32_t n, bool is_final=false, int32_t *start_sample_offset=nullptr) |
| Return n row-major frames starting at the absolute frame_index. | |
NeMo-compatible buffered streaming filter-bank features.
NeMo buffered streaming re-featurizes each requested audio window. Apply preemphasis over that window, then a centered, constant-zero-padded STFT, a symmetric Hann window, Slaney mel filters, and \( \log(\mathrm{mel} + 2^{-24}) \). Input samples are floats in [-1, 1]. This class does not resample or normalize. Like OnlineFbank, instances require external synchronization.
|
explicit |
Construct from the given options.
| void knf::OnlineNemoFbank::AcceptWaveform | ( | float | sampling_rate, |
| const float * | waveform, | ||
| int32_t | n ) |
Add more waveform samples; the sampling rate must match opts.samp_freq.
|
inline |
Return the number of mel bins.
|
inline |
Return the frame shift in seconds.
| std::vector< float > knf::OnlineNemoFbank::GetFrames | ( | int32_t | frame_index, |
| int32_t | n, | ||
| bool | is_final = false, | ||
| int32_t * | start_sample_offset = nullptr ) |
Return n row-major frames starting at the absolute frame_index.
Samples preceding the requested window are discarded; later calls cannot rewind. If is_final reaches the last ready frame after InputFinished(), include the partial hop. When n equals buffered_capacity, cap the window at n hops by shifting its start by the remainder. Report that shift (in samples) through start_sample_offset, which is otherwise zero. A zero-frame request is empty.
|
inline |
Tell the class that no more waveform will be added.
| bool knf::OnlineNemoFbank::IsLastFrame | ( | int32_t | frame | ) | const |
Return true if frame is the last frame.
Only returns true after InputFinished() has been called.
|
inline |
Return the number of whole frames that are ready.
|
inline |
Return the number of buffered samples that do not make up a whole hop.