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

This is a templated class for online feature extraction; it's templated on a class like MfccComputer or FbankComputer that does the basic feature extraction. More...

#include <online-feature.h>

Public Member Functions

 OnlineGenericBaseFeature (const typename C::Options &opts)
 Construct from the options class of the wrapped computer C.
int32_t Dim () const
 Return the dimension of the output features.
float FrameShiftInSeconds () const
 Return the frame shift in seconds.
int32_t NumFramesReady () const
 Return the number of frames that are already computed.
bool IsLastFrame (int32_t frame) const
 Return true if frame is the last frame.
const float * GetFrame (int32_t frame) const
 Return a pointer to the frame-th feature vector.
void AcceptWaveform (float sampling_rate, const float *waveform, int32_t n)
 This would be called from the application, when you get more wave data.
void InputFinished ()
 InputFinished() tells the class you won't be providing any more waveform.
void Pop (int32_t n)
 Discard the first n frames.

Detailed Description

template<class C>
class knf::OnlineGenericBaseFeature< C >

This is a templated class for online feature extraction; it's templated on a class like MfccComputer or FbankComputer that does the basic feature extraction.

Used by:
The aliases OnlineFbank, OnlineMfcc, OnlineWhisperFbank, and OnlineRawAudioSamples at the bottom of this file.
See also
FbankComputer, MfccComputer, WhisperFeatureComputer, RawAudioSamplesComputer, RecyclingVector

Constructor & Destructor Documentation

◆ OnlineGenericBaseFeature()

template<class C>
knf::OnlineGenericBaseFeature< C >::OnlineGenericBaseFeature ( const typename C::Options & opts)
explicit

Construct from the options class of the wrapped computer C.

Member Function Documentation

◆ AcceptWaveform()

template<class C>
void knf::OnlineGenericBaseFeature< C >::AcceptWaveform ( float sampling_rate,
const float * waveform,
int32_t n )

This would be called from the application, when you get more wave data.

Note: the sampling_rate is only provided so the code can assert that it matches the sampling rate expected in the options.

Parameters
sampling_rateThe sampling_rate of the input waveform
waveformPointer to a 1-D array of size n
nNumber of entries in waveform

◆ Dim()

template<class C>
int32_t knf::OnlineGenericBaseFeature< C >::Dim ( ) const
inline

Return the dimension of the output features.

◆ FrameShiftInSeconds()

template<class C>
float knf::OnlineGenericBaseFeature< C >::FrameShiftInSeconds ( ) const
inline

Return the frame shift in seconds.

◆ GetFrame()

template<class C>
const float * knf::OnlineGenericBaseFeature< C >::GetFrame ( int32_t frame) const
inline

Return a pointer to the frame-th feature vector.

The pointer is owned by this object; users should not free it.

◆ InputFinished()

template<class C>
void knf::OnlineGenericBaseFeature< C >::InputFinished ( )

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().

◆ IsLastFrame()

template<class C>
bool knf::OnlineGenericBaseFeature< C >::IsLastFrame ( int32_t frame) const
inline

Return true if frame is the last frame.

Note: IsLastFrame() will only ever return true if you have called InputFinished() (and this frame is the last frame).

◆ NumFramesReady()

template<class C>
int32_t knf::OnlineGenericBaseFeature< C >::NumFramesReady ( ) const
inline

Return the number of frames that are already computed.

◆ Pop()

template<class C>
void knf::OnlineGenericBaseFeature< C >::Pop ( int32_t n)
inline

Discard the first n frames.


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-feature.h