kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
knf::OnlineNemoFbank Class Reference

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.

Detailed Description

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.

See also
NemoFbankOptions, Stft, MelBanks, OnlineFbank

Constructor & Destructor Documentation

◆ OnlineNemoFbank()

knf::OnlineNemoFbank::OnlineNemoFbank ( const NemoFbankOptions & opts)
explicit

Construct from the given options.

Member Function Documentation

◆ AcceptWaveform()

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.

◆ Dim()

int32_t knf::OnlineNemoFbank::Dim ( ) const
inline

Return the number of mel bins.

◆ FrameShiftInSeconds()

float knf::OnlineNemoFbank::FrameShiftInSeconds ( ) const
inline

Return the frame shift in seconds.

◆ GetFrames()

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.

◆ InputFinished()

void knf::OnlineNemoFbank::InputFinished ( )
inline

Tell the class that no more waveform will be added.

◆ IsLastFrame()

bool knf::OnlineNemoFbank::IsLastFrame ( int32_t frame) const

Return true if frame is the last frame.

Only returns true after InputFinished() has been called.

◆ NumFramesReady()

int32_t knf::OnlineNemoFbank::NumFramesReady ( ) const
inline

Return the number of whole frames that are ready.

◆ NumTrailingSamples()

int32_t knf::OnlineNemoFbank::NumTrailingSamples ( ) const
inline

Return the number of buffered samples that do not make up a whole hop.


The documentation for this class was generated from the following file:
  • /home/runner/work/kaldi-native-fbank/kaldi-native-fbank/kaldi-native-fbank/csrc/online-nemo-fbank.h